]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #8845
bors[bot] [Sun, 16 May 2021 19:32:40 +0000 (19:32 +0000)]
Merge #8845

8845: Generate the impl block via generate_trait_impl_text_from_impl r=Veykril a=hi-rustin

Try to close https://github.com/rust-analyzer/rust-analyzer/issues/8827

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
3 years agoMerge #8853
bors[bot] [Sun, 16 May 2021 17:35:40 +0000 (17:35 +0000)]
Merge #8853

8853: Tag Self in impls as a TypeAlias r=matklad a=Veykril

bors r+
Fixes #4398

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #8854
bors[bot] [Sun, 16 May 2021 17:03:43 +0000 (17:03 +0000)]
Merge #8854

8854: internal: use mutable syntax trees when filling fields r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: use mutable syntax trees when filling fields
Aleksey Kladov [Sun, 16 May 2021 15:10:56 +0000 (18:10 +0300)]
internal: use mutable syntax trees when filling fields

3 years agoTag Self in impls as a TypeAlias
Lukas Wirth [Sun, 16 May 2021 13:11:48 +0000 (15:11 +0200)]
Tag Self in impls as a TypeAlias

3 years agointernal: use standard test style
Aleksey Kladov [Sun, 16 May 2021 12:14:57 +0000 (15:14 +0300)]
internal: use standard test style

3 years agointernal: use mutable trees when filling match arms
Aleksey Kladov [Sun, 16 May 2021 12:10:18 +0000 (15:10 +0300)]
internal: use mutable trees when filling match arms

3 years agominor: use uniform names
Aleksey Kladov [Sun, 16 May 2021 11:18:49 +0000 (14:18 +0300)]
minor: use uniform names

3 years agoMerge #8813
bors[bot] [Sun, 16 May 2021 01:53:12 +0000 (01:53 +0000)]
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>
3 years agoAddress final feedback
Jade [Sun, 16 May 2021 01:51:18 +0000 (18:51 -0700)]
Address final feedback

* rename ConstExtension->ConstExt
* refactor a manual construction of a Const

3 years agoMerge #8848
bors[bot] [Sat, 15 May 2021 15:32:54 +0000 (15:32 +0000)]
Merge #8848

8848: Attach comments to ast::Impl r=Veykril a=Veykril

bors r+
Fixes #8847

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAttach comments to ast::Impl
Lukas Wirth [Sat, 15 May 2021 15:23:20 +0000 (17:23 +0200)]
Attach comments to ast::Impl

3 years agosimplify
Lukas Wirth [Sat, 15 May 2021 15:22:39 +0000 (17:22 +0200)]
simplify

3 years agoRemove attrs
hi-rustin [Sat, 15 May 2021 13:12:06 +0000 (21:12 +0800)]
Remove attrs

3 years agoAddress comments and add more tests
hi-rustin [Sat, 15 May 2021 12:07:32 +0000 (20:07 +0800)]
Address comments and add more tests

Fix tests

Fmt code

3 years agoGenerate the impl block via generate_trait_impl_text
hi-rustin [Sat, 15 May 2021 03:29:33 +0000 (11:29 +0800)]
Generate the impl block via generate_trait_impl_text

3 years agoMerge #8843
bors[bot] [Fri, 14 May 2021 23:10:39 +0000 (23:10 +0000)]
Merge #8843

8843: minor: simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agosimplify
Lukas Wirth [Fri, 14 May 2021 23:09:53 +0000 (01:09 +0200)]
simplify

3 years agoMerge #8840
bors[bot] [Fri, 14 May 2021 19:57:52 +0000 (19:57 +0000)]
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>
3 years agoFix false positive "Missing match arm".
Dawer [Fri, 14 May 2021 19:09:17 +0000 (00:09 +0500)]
Fix false positive "Missing match arm".

3 years agoMerge #8839
bors[bot] [Fri, 14 May 2021 17:24:39 +0000 (17:24 +0000)]
Merge #8839

8839: minor: more useful bench r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agominor: more useful bench
Aleksey Kladov [Fri, 14 May 2021 17:23:29 +0000 (20:23 +0300)]
minor: more useful bench

3 years agoMerge #8819
bors[bot] [Fri, 14 May 2021 17:15:21 +0000 (17:15 +0000)]
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>
3 years agoMerge #8838
bors[bot] [Fri, 14 May 2021 17:01:05 +0000 (17:01 +0000)]
Merge #8838

8838: internal: use more mutable APIs r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: use more mutable APIs
Aleksey Kladov [Fri, 14 May 2021 17:00:35 +0000 (20:00 +0300)]
internal: use more mutable APIs

3 years agoMerge #8837
bors[bot] [Fri, 14 May 2021 15:54:38 +0000 (15:54 +0000)]
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>
3 years agointernal: use standard style for tests
Aleksey Kladov [Fri, 14 May 2021 15:53:53 +0000 (18:53 +0300)]
internal: use standard style for tests

3 years agointernal: rewrite assoc item manipulaion to use mutable trees
Aleksey Kladov [Fri, 14 May 2021 15:47:08 +0000 (18:47 +0300)]
internal: rewrite assoc item manipulaion to use mutable trees

3 years agointernal: remove SyntaxRewriter
Aleksey Kladov [Fri, 14 May 2021 13:40:11 +0000 (16:40 +0300)]
internal: remove SyntaxRewriter

3 years agointernal: remove more of the SyntaxRewriter
Aleksey Kladov [Fri, 14 May 2021 13:28:59 +0000 (16:28 +0300)]
internal: remove more of the SyntaxRewriter

3 years agointernal: remove one more immutable tree
Aleksey Kladov [Mon, 10 May 2021 16:04:41 +0000 (19:04 +0300)]
internal: remove one more immutable tree

3 years agoMerge #8831
bors[bot] [Fri, 14 May 2021 09:50:36 +0000 (09:50 +0000)]
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>
3 years agoAddress comments
hi-rustin [Fri, 14 May 2021 09:30:00 +0000 (17:30 +0800)]
Address comments

3 years agoAdd more tests, refactor array lengths/consteval work
Jade [Fri, 14 May 2021 07:59:30 +0000 (00:59 -0700)]
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)

3 years agoApply async semantic token modifier to async/await keywords
hi-rustin [Fri, 14 May 2021 02:36:12 +0000 (10:36 +0800)]
Apply async semantic token modifier to async/await keywords

Only async semantic token modifier

3 years agoMerge #8830
bors[bot] [Thu, 13 May 2021 22:44:34 +0000 (22:44 +0000)]
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>
3 years agoImplement `concat_idents`
Edwin Cheng [Thu, 13 May 2021 22:42:10 +0000 (06:42 +0800)]
Implement `concat_idents`

3 years agoMerge #8822
bors[bot] [Thu, 13 May 2021 20:38:56 +0000 (20:38 +0000)]
Merge #8822

8822: minor: Cleanup imports r=Veykril a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMerge #8814
bors[bot] [Thu, 13 May 2021 17:37:52 +0000 (17:37 +0000)]
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>
3 years agoMerge #8820
bors[bot] [Thu, 13 May 2021 16:48:11 +0000 (16:48 +0000)]
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>
3 years agoMerge #8823
bors[bot] [Thu, 13 May 2021 16:41:25 +0000 (16:41 +0000)]
Merge #8823

8823: Enable OPTION::ENABLE_TASKLISTS in pulldown_cmark r=Veykril a=Veykril

Closes #8821

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #8825
bors[bot] [Thu, 13 May 2021 16:31:42 +0000 (16:31 +0000)]
Merge #8825

8825: Corrected minor typo on line 20 r=lnicola a=mixio

Co-authored-by: mixio <38652479+mixio@users.noreply.github.com>
3 years agoCorrected minor typo on line 20
mixio [Thu, 13 May 2021 16:29:48 +0000 (18:29 +0200)]
Corrected minor typo on line 20

3 years agoEnable OPTION::ENABLE_TASKLISTS in pulldown_cmark
Lukas Wirth [Thu, 13 May 2021 13:09:46 +0000 (15:09 +0200)]
Enable OPTION::ENABLE_TASKLISTS in pulldown_cmark

3 years agoCleanup imports
Aleksey Kladov [Thu, 13 May 2021 10:44:47 +0000 (13:44 +0300)]
Cleanup imports

3 years agofix: Keep doc comments and outer attrs on "Move module to file" assist
Jesse Bakker [Wed, 12 May 2021 13:06:54 +0000 (15:06 +0200)]
fix: Keep doc comments and outer attrs on "Move module to file" assist

3 years agoTest lowering byte strings some more
Jade [Thu, 13 May 2021 04:22:13 +0000 (21:22 -0700)]
Test lowering byte strings some more

3 years agoAdd support for lengths in array repeats, if they are literals
Jade [Wed, 12 May 2021 12:59:35 +0000 (05:59 -0700)]
Add support for lengths in array repeats, if they are literals

Now we will get the type of `[0u8; 4]`.

3 years agoSupport length for ByteStrings
Jade [Wed, 12 May 2021 12:44:01 +0000 (05:44 -0700)]
Support length for ByteStrings

I am not confident that my added byte string parsing is right.

3 years agoAdd lowering of array lengths in types
Jade [Wed, 12 May 2021 11:39:48 +0000 (04:39 -0700)]
Add lowering of array lengths in types

Now e.g.

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

will know about the length of b.

3 years agoUse package root as `cargo check` working directory
Brendan Cully [Thu, 13 May 2021 02:50:52 +0000 (19:50 -0700)]
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.

3 years agoReturn absolute paths in find_path if crate start is ambiguous
Lukas Wirth [Thu, 13 May 2021 00:17:41 +0000 (02:17 +0200)]
Return absolute paths in find_path if crate start is ambiguous

3 years agoMerge #8799
bors[bot] [Wed, 12 May 2021 14:49:43 +0000 (14:49 +0000)]
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>
3 years agoMerge #8802
bors[bot] [Wed, 12 May 2021 14:42:01 +0000 (14:42 +0000)]
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>
3 years agoMerge #8812
bors[bot] [Wed, 12 May 2021 13:22:23 +0000 (13:22 +0000)]
Merge #8812

8812: fix: fix dependencies of build scripts r=jonas-schievink a=jonas-schievink

Previously, we added a dependency for all targets in a package to the package's library target. This is correct for most targets, except build scripts, which run before the library crate is built. This PR removes the incorrect dependency on the library target.

We also used to treat all dependencies the same, which led to build scripts being able to use regular dependencies as well as dev-dependencies. This is also fixed by this PR, and build scripts only depend on build-dependencies.

Incorrect dependency graph:

![screenshot-2021-05-11-23:35:01](https://user-images.githubusercontent.com/1786438/117975228-c2066a80-b32e-11eb-8f01-1e3ea904a608.png)

Fixed graph after this PR:

![screenshot-2021-05-12-14:29:31](https://user-images.githubusercontent.com/1786438/117975253-c9c60f00-b32e-11eb-8f6c-9e42d4e32468.png)

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoFix build script dependencies
Jonas Schievink [Wed, 12 May 2021 12:16:51 +0000 (14:16 +0200)]
Fix build script dependencies

3 years agoMerge #8808
bors[bot] [Tue, 11 May 2021 23:05:07 +0000 (23:05 +0000)]
Merge #8808

8808: fix: Fix fn proc macro input again r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/8806 broke the `TokenMap`, so none of the tokens in fn-like proc macro inputs could be related to the output (presumably this is because of the `clone_for_update`).

This PR instead just sets `delimiter = None;` after the `TokenMap` and `Subtree` are already created.

We should probably have more tests for fn-like proc macros, and consider making the behavior consistent with MBE (which *require* the delimiters to be present).

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoRemove delimiters from proc macro input
Jonas Schievink [Tue, 11 May 2021 23:01:51 +0000 (01:01 +0200)]
Remove delimiters from proc macro input

3 years agoRevert "Strip delimiter from fn-like proc macro input"
Jonas Schievink [Tue, 11 May 2021 22:57:41 +0000 (00:57 +0200)]
Revert "Strip delimiter from fn-like proc macro input"

This reverts commit bda68e23328ca62a71da348a13c4d13cc8f991f3.

3 years agoMerge #8806
bors[bot] [Tue, 11 May 2021 22:27:50 +0000 (22:27 +0000)]
Merge #8806

8806: fix: Strip delimiter from fn-like macro invocations r=jonas-schievink a=jonas-schievink

This broke in https://github.com/rust-analyzer/rust-analyzer/pull/8796 (again), the fix is easy though

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoStrip delimiter from fn-like proc macro input
Jonas Schievink [Tue, 11 May 2021 22:27:16 +0000 (00:27 +0200)]
Strip delimiter from fn-like proc macro input

3 years agoaddress review by @eddyb
Jade [Tue, 11 May 2021 22:18:45 +0000 (15:18 -0700)]
address review by @eddyb

3 years agoMerge #8807
bors[bot] [Tue, 11 May 2021 22:16:27 +0000 (22:16 +0000)]
Merge #8807

8807: internal: Move `dot` invocation to rust-analyzer crate r=jonas-schievink a=jonas-schievink

Addresses https://github.com/rust-analyzer/rust-analyzer/pull/8801#discussion_r630570615

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoMove `dot` invocation to rust-analyzer crate
Jonas Schievink [Tue, 11 May 2021 22:14:59 +0000 (00:14 +0200)]
Move `dot` invocation to rust-analyzer crate

3 years agoMerge #8805
bors[bot] [Tue, 11 May 2021 21:36:26 +0000 (21:36 +0000)]
Merge #8805

8805: fix: Use Cargo target name as crate name r=jonas-schievink a=jonas-schievink

Before:

![screenshot-2021-05-11-23:35:09](https://user-images.githubusercontent.com/1786438/117887823-92654d00-b2b1-11eb-8f3d-0e45f6886a79.png)

After:

![screenshot-2021-05-11-23:35:01](https://user-images.githubusercontent.com/1786438/117887836-985b2e00-b2b1-11eb-898a-5f463c4515f6.png)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUse Cargo target name as crate name
Jonas Schievink [Tue, 11 May 2021 21:34:56 +0000 (23:34 +0200)]
Use Cargo target name as crate name

3 years agoMerge #8398
bors[bot] [Tue, 11 May 2021 19:01:39 +0000 (19:01 +0000)]
Merge #8398

8398: Fix inference with conditionally compiled tails r=flodiebold a=DJMcNab

Fixes #8378

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
3 years agoMerge #8801
bors[bot] [Tue, 11 May 2021 18:02:31 +0000 (18:02 +0000)]
Merge #8801

8801: feat: Allow viewing the crate graph in a webview r=jonas-schievink a=jonas-schievink

This uses `dot` to render the crate graph as an SVD file, and displays it in a VS Code panel. For simple crate graphs, it works quite well:

![screenshot-2021-05-11-16:19:32](https://user-images.githubusercontent.com/1786438/117831361-c4a48980-b274-11eb-9276-240cdf6919aa.png)

Unfortunately, on rust-analyzer itself (and most medium-sized dependency graphs), `dot` runs for around a minute and then produces this mess:

![screenshot-2021-05-11-16:41:37](https://user-images.githubusercontent.com/1786438/117834831-c754ae00-b277-11eb-850b-138495dbeba8.png)

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoBetter node label/shapes
Jonas Schievink [Tue, 11 May 2021 17:50:01 +0000 (19:50 +0200)]
Better node label/shapes

3 years agoMerge #8796
bors[bot] [Tue, 11 May 2021 17:47:45 +0000 (17:47 +0000)]
Merge #8796

8796: internal: rewrite `#[derive]` removal to be based on AST (take 2) r=jonas-schievink a=jonas-schievink

Second attempt of https://github.com/rust-analyzer/rust-analyzer/pull/8443, this uses syntactical attribute offsets in `hir_expand`, and changes `attr.rs` to make those easy to derive.

This will make it easy to add similar attribute removal for attribute macros, unblocking them.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoOnly include workspace crates
Jonas Schievink [Tue, 11 May 2021 17:17:43 +0000 (19:17 +0200)]
Only include workspace crates

3 years agoKeep comments and attrs when extracting struct from enum variant
DropDemBits [Tue, 11 May 2021 06:54:48 +0000 (02:54 -0400)]
Keep comments and attrs when extracting struct from enum variant

3 years agoDocument viewCrateGraph request
Jonas Schievink [Tue, 11 May 2021 14:45:51 +0000 (16:45 +0200)]
Document viewCrateGraph request

3 years agoUpdate crates/ide/src/view_crate_graph.rs
Jonas Schievink [Tue, 11 May 2021 14:42:27 +0000 (16:42 +0200)]
Update crates/ide/src/view_crate_graph.rs

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
3 years agoDistinguish crates with identical name
Jonas Schievink [Tue, 11 May 2021 14:36:00 +0000 (16:36 +0200)]
Distinguish crates with identical name

3 years agoAllow viewing the crate graph in a webview
Jonas Schievink [Tue, 11 May 2021 14:15:31 +0000 (16:15 +0200)]
Allow viewing the crate graph in a webview

3 years agoMerge #8800
bors[bot] [Tue, 11 May 2021 13:14:55 +0000 (13:14 +0000)]
Merge #8800

8800: feat: Make "pull assignments up" assist work in more cases r=Jesse-Bakker a=Jesse-Bakker

Fixes #8771

Co-authored-by: Jesse Bakker <github@jessebakker.com>
3 years agoMake "pull assignments up" assist work in more cases
Jesse Bakker [Tue, 11 May 2021 12:22:51 +0000 (14:22 +0200)]
Make "pull assignments up" assist work in more cases

3 years agoAdd basic support for array lengths in types
Jade [Tue, 11 May 2021 12:06:33 +0000 (05:06 -0700)]
Add basic support for array lengths in types

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?

3 years agoMerge #8798
bors[bot] [Tue, 11 May 2021 10:07:25 +0000 (10:07 +0000)]
Merge #8798

8798: internal: use modern resolever r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: use modern resolever
Aleksey Kladov [Tue, 11 May 2021 10:06:35 +0000 (13:06 +0300)]
internal: use modern resolever

I don't think this affects us, but better to stick to modern
practicies.

3 years agoRewrite `#[derive]` removal to be based on AST
Jonas Schievink [Mon, 10 May 2021 20:54:17 +0000 (22:54 +0200)]
Rewrite `#[derive]` removal to be based on AST

3 years agoMerge #8794
bors[bot] [Mon, 10 May 2021 20:10:59 +0000 (20:10 +0000)]
Merge #8794

8794: Give MergeBehaviour variants better names r=Veykril a=Veykril

I never really liked the variant names I gave this enum from the beginning and then I found out about rustfmt's `imports_granularity` config:

> imports_granularity
>
> How imports should be grouped into use statements. Imports will be merged or split to the configured level of granularity.
>
>     Default value: Preserve
>     Possible values: Preserve, Crate, Module, Item
>     Stable: No

I personally prefer using `crate` over `full` and `module` over last, they seem more descriptive. Keeping these similar between tooling also seems like a good plus point to me.

We might even wanna take over the entire enum at some point if we have a `format/cleanup imports` assists in the future which would probably want to also have the `preserve` and `item` options.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoUpdate docs
Lukas Wirth [Mon, 10 May 2021 19:33:01 +0000 (21:33 +0200)]
Update docs

3 years agoRewrite `attr.rs` to allow using syntax-based indices
Jonas Schievink [Mon, 10 May 2021 19:50:42 +0000 (21:50 +0200)]
Rewrite `attr.rs` to allow using syntax-based indices

3 years agoGive MergeBehaviour variants better names
Lukas Wirth [Mon, 10 May 2021 19:03:50 +0000 (21:03 +0200)]
Give MergeBehaviour variants better names

3 years agoMerge #8793
bors[bot] [Mon, 10 May 2021 18:08:26 +0000 (18:08 +0000)]
Merge #8793

8793: Corrected 2 typos on line 83 r=Veykril a=mixio

Co-authored-by: mixio <38652479+mixio@users.noreply.github.com>
3 years agoCorrected 2 typos on line 83
mixio [Mon, 10 May 2021 18:05:32 +0000 (20:05 +0200)]
Corrected 2 typos on line 83

3 years agoMove `AttrId` back into `hir_def`
Jonas Schievink [Mon, 10 May 2021 14:35:06 +0000 (16:35 +0200)]
Move `AttrId` back into `hir_def`

3 years agoMerge #8791
bors[bot] [Mon, 10 May 2021 13:21:33 +0000 (13:21 +0000)]
Merge #8791

8791: feat: auto-indent use tree lists r=jonas-schievink a=jonas-schievink

![Peek 2021-05-10 15-20](https://user-images.githubusercontent.com/1786438/117665627-53e16c80-b1a3-11eb-8906-1b88b394367b.gif)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agofeat: auto-indent use tree lists
Jonas Schievink [Mon, 10 May 2021 13:10:56 +0000 (15:10 +0200)]
feat: auto-indent use tree lists

3 years agoMerge #8790
bors[bot] [Mon, 10 May 2021 12:44:17 +0000 (12:44 +0000)]
Merge #8790

8790: fix: fix manual rendering r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agofix: fix manual rendering
Aleksey Kladov [Mon, 10 May 2021 12:43:01 +0000 (15:43 +0300)]
fix: fix manual rendering

We add `// see the other repo` comments before headers (==). This one isn't a header, but a closing of the example block.

3 years agoMerge #8789
bors[bot] [Mon, 10 May 2021 12:26:52 +0000 (12:26 +0000)]
Merge #8789

8789: simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agosimplify
Aleksey Kladov [Mon, 10 May 2021 12:25:56 +0000 (15:25 +0300)]
simplify

3 years agoMerge #8784
bors[bot] [Sun, 9 May 2021 20:17:37 +0000 (20:17 +0000)]
Merge #8784

8784: feat: auto-insert `}` when typing `{` in use item r=jonas-schievink a=jonas-schievink

![Peek 2021-05-09 22-14](https://user-images.githubusercontent.com/1786438/117585742-45983f80-b114-11eb-80fc-d44f480fd012.gif)

cc https://github.com/rust-analyzer/rust-analyzer/issues/8636

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agofeat: auto-insert `}` when typing `{` in use item
Jonas Schievink [Sun, 9 May 2021 20:12:58 +0000 (22:12 +0200)]
feat: auto-insert `}` when typing `{` in use item

3 years agoMerge #8783
bors[bot] [Sun, 9 May 2021 16:56:02 +0000 (16:56 +0000)]
Merge #8783

8783: internal: introduce `ast::make::ext` module with common shortcuts r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agointernal: introduce `ast::make::ext` module with common shortcuts
Aleksey Kladov [Sun, 9 May 2021 16:51:06 +0000 (19:51 +0300)]
internal: introduce `ast::make::ext` module with common shortcuts

There's a tension between keeping a well-architectured minimal
orthogonal set of constructs, and providing convenience functions.
Relieve this pressure by introducing an dedicated module for
non-orthogonal shortcuts.

This is inspired by the django.shortcuts module which serves a similar
purpose architecturally.

3 years agoMerge #8782
bors[bot] [Sun, 9 May 2021 16:23:03 +0000 (16:23 +0000)]
Merge #8782

8782: internal: fix make API r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>