]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoMerge #7958
bors[bot] [Wed, 10 Mar 2021 15:07:46 +0000 (15:07 +0000)]
Merge #7958

7958: Avoid double text edits when renaming mod declaration r=matklad a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7916

See https://github.com/microsoft/vscode-languageserver-node/issues/752 for context

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoAvoid double text edits when renaming mod declaration
Lukas Wirth [Wed, 10 Mar 2021 14:49:01 +0000 (15:49 +0100)]
Avoid double text edits when renaming mod declaration

3 years agoMerge #7874
bors[bot] [Wed, 10 Mar 2021 14:34:59 +0000 (14:34 +0000)]
Merge #7874

7874: add apply ssr assist r=JoshMcguigan a=JoshMcguigan

This PR adds an `Apply SSR` assist which was briefly mentioned in #3186. It allows writing an ssr rule as a comment, and then applying that SSR via an assist. This workflow is much nicer than the default available via `coc-rust-analyzer` when iterating to find the proper replacement.

As currently implemented, this requires the ssr rule is written as a single line in the comment, and it doesn't require any kind of prefix. Anything which properly parses as a ssr rule will enable the assist. The benefit of requiring the ssr rule be on a single line is it allows for a workflow where the user has several rules written one after the other, possibly to be triggered in order, without having to try to parse multiple lines of text and determine where one rule ends and the next begins. The benefit of not requiring a prefix is less typing :laughing:  - plus, I think the chance of something accidentally parsing as an ssr rule is minimal.

I think a reasonable extension of this would be to allow either any ssr rule that fits on a single line, or any comment block which in its entirety makes up a single ssr rule (parsing a comment block containing multiple ssr rules and running them all would break the use case that currently works where a user writes multiple ssr rules then runs them each one by one in arbitrary order).

I've marked this as a draft because for some reason I am strugging to make the unit tests pass. It does work when I compile rust-analyzer and test it in my editor though, so I'm not sure what is going on.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
3 years agoadd apply ssr assist
Josh Mcguigan [Tue, 9 Mar 2021 05:11:28 +0000 (21:11 -0800)]
add apply ssr assist

3 years agoMerge #7957
bors[bot] [Wed, 10 Mar 2021 09:42:36 +0000 (09:42 +0000)]
Merge #7957

7957: Fix labels for single import assists r=SomeoneToIgnore a=SomeoneToIgnore

Before:
![image](https://user-images.githubusercontent.com/2690773/110609185-a26b8e00-8195-11eb-87be-d21b75817c22.png)

After:
![image](https://user-images.githubusercontent.com/2690773/110609198-a5667e80-8195-11eb-8c58-9ae19ba71905.png)

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
3 years agoFix labels for single import assists
Kirill Bulatov [Wed, 10 Mar 2021 09:30:25 +0000 (11:30 +0200)]
Fix labels for single import assists

3 years agoMerge #7955
bors[bot] [Wed, 10 Mar 2021 01:32:40 +0000 (01:32 +0000)]
Merge #7955

7955: Stop fetching ItemTrees for no reason r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoStop fetching ItemTrees for no reason
Jonas Schievink [Wed, 10 Mar 2021 01:32:16 +0000 (02:32 +0100)]
Stop fetching ItemTrees for no reason

3 years agoMerge #6822
bors[bot] [Tue, 9 Mar 2021 20:57:04 +0000 (20:57 +0000)]
Merge #6822

6822: Read version of rustc that compiled proc macro r=edwin0cheng a=jsomedon

Signed-off-by: Jay Somedon <jay.somedon@outlook.com>
This PR is to fix #6174.

I basically
* added two methods, `read_version` and `read_section`(used by `read_version`)
* two new crates `snap` and `object` to be used by those two methods

I just noticed that some part of code were auto-reformatted by rust-analyzer on file save. Does it matter?

Co-authored-by: Jay Somedon <jay.somedon@outlook.com>
Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
3 years agouse doc-comments
Edwin Cheng [Tue, 9 Mar 2021 20:54:31 +0000 (04:54 +0800)]
use doc-comments

3 years agoMerge #7949
bors[bot] [Tue, 9 Mar 2021 19:31:22 +0000 (19:31 +0000)]
Merge #7949

7949: Compilation speed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoCompilation speed
Aleksey Kladov [Tue, 9 Mar 2021 19:30:58 +0000 (22:30 +0300)]
Compilation speed

3 years agoMerge #7948
bors[bot] [Tue, 9 Mar 2021 18:11:18 +0000 (18:11 +0000)]
Merge #7948

7948: Delete `ContainerId` r=jonas-schievink a=jonas-schievink

Since block expressions containing items now have a `ModuleId`, there's no need to also treat `DefWithBodyId` as a potential item container. Since https://github.com/rust-analyzer/rust-analyzer/pull/7878, only the `ModuleId` variant of `ContainerId` was ever created, so just delete the thing and use `ModuleId` everywhere.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoDelete `ContainerId`
Jonas Schievink [Tue, 9 Mar 2021 18:09:02 +0000 (19:09 +0100)]
Delete `ContainerId`

3 years agoMerge #7878
bors[bot] [Tue, 9 Mar 2021 17:34:18 +0000 (17:34 +0000)]
Merge #7878

7878: Remove `item_scope` field from `Body` r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7632

Instead of storing an `ItemScope` filled with inner items, we store the list of `BlockId`s for all block expressions that are part of a `Body`. Code can then query the `block_def_map` for those.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoStop using `ContainerId` in `AssocContainerId`
Jonas Schievink [Tue, 9 Mar 2021 17:27:16 +0000 (18:27 +0100)]
Stop using `ContainerId` in `AssocContainerId`

3 years agoCheck ancestor maps when computing traits in scope
Jonas Schievink [Tue, 9 Mar 2021 17:18:35 +0000 (18:18 +0100)]
Check ancestor maps when computing traits in scope

3 years agoRemove `item_scope` field from `Body`
Jonas Schievink [Fri, 5 Mar 2021 13:53:54 +0000 (14:53 +0100)]
Remove `item_scope` field from `Body`

3 years agoUse `body.block_scopes` in `hir_ty` tests
Jonas Schievink [Fri, 5 Mar 2021 13:53:32 +0000 (14:53 +0100)]
Use `body.block_scopes` in `hir_ty` tests

3 years agoUse `body.block_scopes` to validate inner items
Jonas Schievink [Fri, 5 Mar 2021 13:15:26 +0000 (14:15 +0100)]
Use `body.block_scopes` to validate inner items

3 years agoUse `body.block_scopes` in `ChildBySource`
Jonas Schievink [Fri, 5 Mar 2021 13:08:36 +0000 (14:08 +0100)]
Use `body.block_scopes` in `ChildBySource`

3 years agoStore inner `BlockId`s in `Body`
Jonas Schievink [Fri, 5 Mar 2021 13:08:23 +0000 (14:08 +0100)]
Store inner `BlockId`s in `Body`

3 years agoChange `ChildBySource` to allow reusing `DynMap`
Jonas Schievink [Fri, 5 Mar 2021 13:06:09 +0000 (14:06 +0100)]
Change `ChildBySource` to allow reusing `DynMap`

3 years agoMerge #7945
bors[bot] [Tue, 9 Mar 2021 17:25:23 +0000 (17:25 +0000)]
Merge #7945

7945: Future proof completion scores r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoFuture proof completion scores
Aleksey Kladov [Tue, 9 Mar 2021 17:24:09 +0000 (20:24 +0300)]
Future proof completion scores

3 years agoMerge #7942
bors[bot] [Tue, 9 Mar 2021 16:23:51 +0000 (16:23 +0000)]
Merge #7942

7942: Show whether a binding is mutable or not on hover r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoShow whether a binding is mutable or not on hover
Lukas Wirth [Tue, 9 Mar 2021 15:33:41 +0000 (16:33 +0100)]
Show whether a binding is mutable or not on hover

3 years agoMerge #7944
bors[bot] [Tue, 9 Mar 2021 16:05:23 +0000 (16:05 +0000)]
Merge #7944

7944: Selecting `&mut foo` completion now actually inserts `&mut` r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoSelecting `&mut foo` completion now actually inserts `&mut`
Aleksey Kladov [Tue, 9 Mar 2021 16:04:27 +0000 (19:04 +0300)]
Selecting `&mut foo` completion now actually inserts `&mut`

3 years agoDon't show const items initializer expressions on hover
Lukas Wirth [Tue, 9 Mar 2021 15:33:23 +0000 (16:33 +0100)]
Don't show const items initializer expressions on hover

3 years agoCleanup auto-ref in completion
Aleksey Kladov [Tue, 9 Mar 2021 15:06:08 +0000 (18:06 +0300)]
Cleanup auto-ref in completion

3 years agoMerge #7941
bors[bot] [Tue, 9 Mar 2021 14:54:24 +0000 (14:54 +0000)]
Merge #7941

7941: Fix unused definitions not being document highlit r=Veykril a=Veykril

Fixes #7939

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #7940
bors[bot] [Tue, 9 Mar 2021 14:46:10 +0000 (14:46 +0000)]
Merge #7940

7940: Cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoFix unused definitions not being document highlit
Lukas Wirth [Tue, 9 Mar 2021 14:45:31 +0000 (15:45 +0100)]
Fix unused definitions not being document highlit

3 years agoCleanup
Aleksey Kladov [Tue, 9 Mar 2021 14:44:27 +0000 (17:44 +0300)]
Cleanup

3 years agoCleanup
Aleksey Kladov [Tue, 9 Mar 2021 14:42:05 +0000 (17:42 +0300)]
Cleanup

3 years agoFix bad names
Aleksey Kladov [Tue, 9 Mar 2021 14:39:22 +0000 (17:39 +0300)]
Fix bad names

`res` should only be used for the result variable

3 years agoMerge #7873 #7933
bors[bot] [Tue, 9 Mar 2021 11:58:48 +0000 (11:58 +0000)]
Merge #7873 #7933

7873: Consider unresolved qualifiers during flyimport r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/7679

Takes unresolved qualifiers into account, providing better completions (or none, if the path is resolved or do not match).

Does not handle cases when both path qualifier and some trait has to be imported: there are many extra issues with those (such as overlapping imports, for instance) that will require large diffs to address.

Also does not do a fuzzy search on qualifier, that requires some adjustments in `import_map` for better queries and changes to the default replace range which also seems relatively big to include here.

![qualifier_completion](https://user-images.githubusercontent.com/2690773/110040808-0af8dc00-7d4c-11eb-83db-65af94e843bb.gif)

7933: Improve compilation speed r=matklad a=matklad

bors r+
🤖

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoImprove compilation speed
Aleksey Kladov [Tue, 9 Mar 2021 11:54:50 +0000 (14:54 +0300)]
Improve compilation speed

3 years agoMerge #7932
bors[bot] [Tue, 9 Mar 2021 11:48:08 +0000 (11:48 +0000)]
Merge #7932

7932: Make code less surprising r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMake code less surprising
Aleksey Kladov [Tue, 9 Mar 2021 11:43:05 +0000 (14:43 +0300)]
Make code less surprising

Theres no reason to have literal `\n\n` in the source code

3 years agoMerge #7931
bors[bot] [Tue, 9 Mar 2021 11:36:40 +0000 (11:36 +0000)]
Merge #7931

7931: Use `Type::new_with_resolver_inner` more r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
3 years agoUse `Type::new_with_resolver_inner` more
Jonas Schievink [Tue, 9 Mar 2021 11:31:16 +0000 (12:31 +0100)]
Use `Type::new_with_resolver_inner` more

3 years agoMerge #7927
bors[bot] [Tue, 9 Mar 2021 11:22:37 +0000 (11:22 +0000)]
Merge #7927

7927: Add more documentation for rustc_private r=matklad a=jyn514

Co-authored-by: Joshua Nelson <jyn514@gmail.com>
3 years agoMerge #7928
bors[bot] [Tue, 9 Mar 2021 11:13:17 +0000 (11:13 +0000)]
Merge #7928

7928: Add completion to turn x.err into Err(x) r=matklad a=duongdominhchau

PR for issue #7925

Co-authored-by: Duong Do Minh Chau <duongdominhchau@gmail.com>
3 years agoFix format
Duong Do Minh Chau [Tue, 9 Mar 2021 09:38:07 +0000 (16:38 +0700)]
Fix format

3 years agoMerge #7930
bors[bot] [Tue, 9 Mar 2021 09:03:07 +0000 (09:03 +0000)]
Merge #7930

7930: Clarify that all caps are experimental r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoClarify that all caps are experimental
Aleksey Kladov [Tue, 9 Mar 2021 09:02:20 +0000 (12:02 +0300)]
Clarify that all caps are experimental

3 years agoAdd trailing commas
Duong Do Minh Chau [Tue, 9 Mar 2021 09:00:06 +0000 (16:00 +0700)]
Add trailing commas

3 years agoUpdate the test to match the change
Duong Do Minh Chau [Tue, 9 Mar 2021 08:48:53 +0000 (15:48 +0700)]
Update the test to match the change

3 years agoAdd completion to turn x.err into Err(x)
Duong Do Minh Chau [Tue, 9 Mar 2021 08:36:41 +0000 (15:36 +0700)]
Add completion to turn x.err into Err(x)

3 years agoMerge #7898
bors[bot] [Mon, 8 Mar 2021 22:51:04 +0000 (22:51 +0000)]
Merge #7898

7898: generate_function assist: infer return type r=JoshMcguigan a=JoshMcguigan

This PR makes two changes to the generate function assist:

1. Attempt to infer an appropriate return type for the generated function
2. If a return type is inferred, and that return type is not unit, don't render the snippet

```rust
fn main() {
    let x: u32 = foo$0();
    //              ^^^ trigger the assist to generate this function
}

// BEFORE
fn foo() ${0:-> ()} {
    todo!()
}

// AFTER (only change 1)
fn foo() ${0:-> u32} {
    todo!()
}

// AFTER (change  1 and 2, note the lack of snippet around the return type)
fn foo() -> u32 {
    todo!()
}
```

These changes are made as two commits, in case we want to omit change 2. I personally feel like it is a nice change, but I could understand there being some opposition.

#### Pros of change 2
If we are able to infer a return type, and especially if that return type is not the unit type, the return type is almost as likely to be correct as the argument names/types. I think this becomes even more true as people learn how this feature works.

#### Cons of change 2

We could never be as confident about the return type as we are about the function argument types, so it is more likely a user will want to change that. Plus it is a confusing UX to sometimes have the cursor highlight the return type after triggering this assist and sometimes not have that happen.

#### Why omit unit type?

The assumption is that if we infer the return type as unit, it is likely just because of the current structure of the code rather than that actually being the desired return type. However, this is obviously just a heuristic and will sometimes be wrong. But being wrong here just means falling back to the exact behavior that existed before this PR.

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
3 years agogenerate_function assist don't render snippet if ret type inferred
Josh Mcguigan [Sat, 6 Mar 2021 22:29:45 +0000 (14:29 -0800)]
generate_function assist don't render snippet if ret type inferred

3 years agoBetter strip turbofishes
Kirill Bulatov [Mon, 8 Mar 2021 12:59:54 +0000 (14:59 +0200)]
Better strip turbofishes

3 years agoAdd rustdocs and use better names
Kirill Bulatov [Mon, 8 Mar 2021 12:09:20 +0000 (14:09 +0200)]
Add rustdocs and use better names

3 years agoLess lifetines: derive SemanticsScope in place
Kirill Bulatov [Sun, 7 Mar 2021 22:25:45 +0000 (00:25 +0200)]
Less lifetines: derive SemanticsScope in place

3 years agoRebase leftovers
Kirill Bulatov [Sun, 7 Mar 2021 09:58:43 +0000 (11:58 +0200)]
Rebase leftovers

3 years agoCleanup
Kirill Bulatov [Thu, 4 Mar 2021 22:29:39 +0000 (00:29 +0200)]
Cleanup

3 years agoRestrict fuzzy qualifiers for now
Kirill Bulatov [Thu, 4 Mar 2021 22:11:07 +0000 (00:11 +0200)]
Restrict fuzzy qualifiers for now

3 years agoTest for fuzzy unresolved path maatch
Kirill Bulatov [Wed, 3 Mar 2021 22:10:20 +0000 (00:10 +0200)]
Test for fuzzy unresolved path maatch

3 years agoEnforce the located imports' order
Kirill Bulatov [Wed, 3 Mar 2021 21:59:56 +0000 (23:59 +0200)]
Enforce the located imports' order

3 years agoFix the completion labels and tests
Kirill Bulatov [Wed, 3 Mar 2021 21:55:21 +0000 (23:55 +0200)]
Fix the completion labels and tests

3 years agoWork towards better import labels
Kirill Bulatov [Tue, 2 Mar 2021 23:26:53 +0000 (01:26 +0200)]
Work towards better import labels

3 years agoProfile import_assets better
Kirill Bulatov [Mon, 1 Mar 2021 12:27:07 +0000 (14:27 +0200)]
Profile import_assets better

3 years agoUpdate the docs
Kirill Bulatov [Mon, 1 Mar 2021 12:14:24 +0000 (14:14 +0200)]
Update the docs

3 years agoSimplify
Kirill Bulatov [Mon, 1 Mar 2021 11:55:47 +0000 (13:55 +0200)]
Simplify

3 years agoRefactor the import location
Kirill Bulatov [Sun, 28 Feb 2021 22:05:22 +0000 (00:05 +0200)]
Refactor the import location

3 years agoDo not propose already imported imports
Kirill Bulatov [Sun, 28 Feb 2021 08:32:15 +0000 (10:32 +0200)]
Do not propose already imported imports

3 years agoProperly handle turbofishes in qualifiers
Kirill Bulatov [Sun, 28 Feb 2021 07:57:54 +0000 (09:57 +0200)]
Properly handle turbofishes in qualifiers

3 years agoFix some tests
Kirill Bulatov [Wed, 24 Feb 2021 23:53:59 +0000 (01:53 +0200)]
Fix some tests

3 years agoReturn more data about located imports
Kirill Bulatov [Wed, 24 Feb 2021 23:06:31 +0000 (01:06 +0200)]
Return more data about located imports

3 years agoDraft the qualifier import resolution
Kirill Bulatov [Tue, 23 Feb 2021 23:20:00 +0000 (01:20 +0200)]
Draft the qualifier import resolution

3 years agoFilter out path items by the qualifier
Kirill Bulatov [Sun, 21 Feb 2021 22:51:13 +0000 (00:51 +0200)]
Filter out path items by the qualifier

3 years agoSimplify
Kirill Bulatov [Sun, 21 Feb 2021 21:52:29 +0000 (23:52 +0200)]
Simplify

3 years agoFind the code to change
Kirill Bulatov [Sat, 20 Feb 2021 22:14:27 +0000 (00:14 +0200)]
Find the code to change

3 years agoTest and initial refactoring
Kirill Bulatov [Sat, 20 Feb 2021 21:32:21 +0000 (23:32 +0200)]
Test and initial refactoring

3 years agoAdd more documentation for rustc_private
Joshua Nelson [Mon, 8 Mar 2021 21:56:42 +0000 (16:56 -0500)]
Add more documentation for rustc_private

3 years agoMerge #7924
bors[bot] [Mon, 8 Mar 2021 21:19:31 +0000 (21:19 +0000)]
Merge #7924

7924: Use upstream cov-mark r=matklad a=lnicola

Closes #7922

But doesn't remove any dependency, unfortunately.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUse upstream cov-mark
Laurențiu Nicola [Mon, 8 Mar 2021 20:19:44 +0000 (22:19 +0200)]
Use upstream cov-mark

3 years agoMerge #7923
bors[bot] [Mon, 8 Mar 2021 19:16:05 +0000 (19:16 +0000)]
Merge #7923

7923: Remove useless code_model indirection r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoHygiene is an internal implementation detail of the compiler
Aleksey Kladov [Mon, 8 Mar 2021 19:14:52 +0000 (22:14 +0300)]
Hygiene is an internal implementation detail of the compiler

3 years agoRemove useless code_model indirection
Aleksey Kladov [Mon, 8 Mar 2021 19:08:30 +0000 (22:08 +0300)]
Remove useless code_model indirection

3 years agoMerge #7918
bors[bot] [Mon, 8 Mar 2021 18:52:08 +0000 (18:52 +0000)]
Merge #7918

7918: Generalize file ensuring infrastructure r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMinor
Aleksey Kladov [Mon, 8 Mar 2021 18:49:25 +0000 (21:49 +0300)]
Minor

3 years agoCleanup the error message
Aleksey Kladov [Mon, 8 Mar 2021 18:41:45 +0000 (21:41 +0300)]
Cleanup the error message

3 years agoRemove now dead code
Aleksey Kladov [Mon, 8 Mar 2021 18:39:09 +0000 (21:39 +0300)]
Remove now dead code

3 years agoUnused params
Aleksey Kladov [Mon, 8 Mar 2021 18:25:44 +0000 (21:25 +0300)]
Unused params

3 years agoMake `code generation` just work
Aleksey Kladov [Mon, 8 Mar 2021 18:13:15 +0000 (21:13 +0300)]
Make `code generation` just work

Contributors don't need to learn about `cargo xtask codegen` if `cargo
test` just does the right thing.

3 years agoUse the same name in xtask and test utils
Aleksey Kladov [Mon, 8 Mar 2021 17:22:33 +0000 (20:22 +0300)]
Use the same name in xtask and test utils

3 years agoGeneralize file ensuring infrastructure
Aleksey Kladov [Mon, 8 Mar 2021 14:20:36 +0000 (17:20 +0300)]
Generalize file ensuring infrastructure

3 years agoMake working with codegen less annoying
Aleksey Kladov [Mon, 8 Mar 2021 13:35:27 +0000 (16:35 +0300)]
Make working with codegen less annoying

We probably should look into removing `xtask codegen` altogether. The
test workflow works perfectly for package.json config.

There are two things preventing that:

* Lint completions are generated on demand.
* Docs are not committed to the repository.

3 years agoMerge #7921
bors[bot] [Mon, 8 Mar 2021 17:37:43 +0000 (17:37 +0000)]
Merge #7921

7921: Don't punish every crate with serde-json r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDon't punish every crate with serde-json
Aleksey Kladov [Mon, 8 Mar 2021 17:27:08 +0000 (20:27 +0300)]
Don't punish every crate with serde-json

3 years agoMerge #7891
bors[bot] [Mon, 8 Mar 2021 16:51:20 +0000 (16:51 +0000)]
Merge #7891

7891: Improve handling of rustc_private r=matklad a=DJMcNab

This PR changes how `rust-analyzer` handles `rustc_private`. In particular, packages now must opt-in to using `rustc_private` in `Cargo.toml`, by adding:
```toml
[package.metadata.rust-analyzer]
rustc_private=true
```

This means that depending on crates which also use `rustc_private` will be significantly improved, since their dependencies on the `rustc_private` crates will be resolved properly.

A similar approach could be used in #6714 to allow annotating that your package uses the `test` crate, although I have not yet handled that in this PR.

Additionally, we now only index the crates which are transitive dependencies of `rustc_driver` in the `rustcSource` directory. This should not cause any change in behaviour when using `rustcSource: "discover"`, as the source used then will only be a partial clone. However, if `rustcSource` pointing at a local checkout of rustc, this should significantly improve the memory usage and lower indexing time. This is because we avoids indexing all crates in `src/tools/`, which includes `rust-analyzer` itself.

Furthermore, we also prefer named dependencies over dependencies from `rustcSource`. This ensures that feature resolution for crates which are depended on by both `rustc` and your crate uses the correct set for analysing your crate.

See also [introductory zulip stream](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Fixed.20crate.20graphs.20and.20optional.20builtin.20crates/near/229086673)

I have tested this in [priroda](https://github.com/oli-obk/priroda/), and it provides a significant improvement to the development experience (once I give `miri` the required data in `Cargo.toml`)

Todo:
- [ ] Documentation

This is ready to review, and I will add documentation if this would be accepted (or if I get time to do so anyway)

Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com>
3 years agoDocument rustc_private in metadata
Daniel McNab [Mon, 8 Mar 2021 16:47:40 +0000 (16:47 +0000)]
Document rustc_private in metadata

3 years agoNever run cargo check on the rustc source
Daniel McNab [Mon, 8 Mar 2021 16:42:18 +0000 (16:42 +0000)]
Never run cargo check on the rustc source

3 years agoOnly show directory name
Daniel McNab [Mon, 8 Mar 2021 16:41:40 +0000 (16:41 +0000)]
Only show directory name

3 years agoRevert "Support disabling rustc build scripts"
Daniel McNab [Mon, 8 Mar 2021 16:37:52 +0000 (16:37 +0000)]
Revert "Support disabling rustc build scripts"

This reverts commit ddce6bb282764692d53b719bff4c37e3512d4556.

3 years agoMerge #7920
bors[bot] [Mon, 8 Mar 2021 15:40:48 +0000 (15:40 +0000)]
Merge #7920

7920: Cargo update r=kjeremy a=kjeremy

Chalk changes just a version # bump. There are no actual commits.

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoCargo update
kjeremy [Mon, 8 Mar 2021 15:39:11 +0000 (10:39 -0500)]
Cargo update

Chalk changes just a version # bump. There are no actual commits.