]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUse mutable syntax trees in `merge_imports`, `split_imports`
iDawer [Fri, 19 Nov 2021 09:06:36 +0000 (14:06 +0500)]
Use mutable syntax trees in `merge_imports`, `split_imports`

2 years agoMerge #10807
bors[bot] [Fri, 19 Nov 2021 12:20:13 +0000 (12:20 +0000)]
Merge #10807

10807: fix: Diagnose invalid derive attribute input r=Veykril a=Veykril

Doesn't yet diagnose incorrect syntax between the `(`, `)` braces as we discard those problems currently.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Diagnose invalid derive attribute input
Lukas Wirth [Fri, 19 Nov 2021 12:17:35 +0000 (13:17 +0100)]
fix: Diagnose invalid derive attribute input

2 years agoMerge #10806
bors[bot] [Fri, 19 Nov 2021 11:46:49 +0000 (11:46 +0000)]
Merge #10806

10806: fix: inlay param hint hiding heurstic is case unsensitive r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: inlay param hint hiding heurstic is case unsensitive
Lukas Wirth [Fri, 19 Nov 2021 11:46:03 +0000 (12:46 +0100)]
fix: inlay param hint hiding heurstic is case unsensitive

2 years agoMerge #10804
bors[bot] [Fri, 19 Nov 2021 11:34:22 +0000 (11:34 +0000)]
Merge #10804

10804: fix: Diagnose using `derive` on non-adt items r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Diagnose using `derive` on non-adt items
Lukas Wirth [Thu, 18 Nov 2021 21:17:22 +0000 (22:17 +0100)]
fix: Diagnose using `derive` on non-adt items

2 years agoMerge #10805
bors[bot] [Fri, 19 Nov 2021 10:59:49 +0000 (10:59 +0000)]
Merge #10805

10805: ide: dedupe or merge hover actions r=Veykril a=jhgg

fixes #10780

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoide: dedupe or merge hover actions
Jake Heinz [Thu, 18 Nov 2021 11:34:33 +0000 (11:34 +0000)]
ide: dedupe or merge hover actions

2 years agoMerge #10803
bors[bot] [Thu, 18 Nov 2021 20:45:20 +0000 (20:45 +0000)]
Merge #10803

10803: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: Simplify
Lukas Wirth [Thu, 18 Nov 2021 20:43:54 +0000 (21:43 +0100)]
minor: Simplify

2 years agoMerge #10798
bors[bot] [Thu, 18 Nov 2021 09:56:44 +0000 (09:56 +0000)]
Merge #10798

10798: ide: show go to for function hover return type r=Veykril a=jhgg

I've found myself wanting this...  adds to the hover quick go-to for a function's return type:

![image](https://user-images.githubusercontent.com/5489149/142375722-4a385216-494b-45a4-be1c-59664213b8d6.png)

This is particularly useful when you are hovering over a function in a long chain, like:

```rust
foo.bar().b$0az().some_trait_fn();
```

where `baz`'s return type is not immediately obvious, but the chain is not long enough to trigger chain inlay hints...

i guess I could just select `foo.bar().baz()` too to get the types too...

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoMerge #10796
bors[bot] [Thu, 18 Nov 2021 09:48:10 +0000 (09:48 +0000)]
Merge #10796

10796: ide: display static values in hover r=Veykril a=jhgg

Continuation from #10785 - does the same thing, but for `static`'s as well.

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoMerge #10795
bors[bot] [Thu, 18 Nov 2021 09:40:59 +0000 (09:40 +0000)]
Merge #10795

10795: Remove unwrap in doc path resolution r=Veykril a=udoprog

I keep hitting this constantly in my project, and I haven't dug very deep into the root cause. But seeing as the project otherwise compiles it appears to be something unsupported is being incorrectly parsed in rust-analyzer which for other cases is handled by returning `None`.

Co-authored-by: John-John Tedro <udoprog@tedro.se>
2 years agoMerge #10794
bors[bot] [Thu, 18 Nov 2021 09:33:47 +0000 (09:33 +0000)]
Merge #10794

10794: fix: parse the range pat inside the tuple pat r=lnicola a=XFFXFF

fixes #10784

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agoMerge #10799
bors[bot] [Thu, 18 Nov 2021 08:38:07 +0000 (08:38 +0000)]
Merge #10799

10799: fix: Fix proc macro ABI version checks r=lnicola a=lnicola

If I'm reading this right, we used to pick `Abi1_55` for `1.54` and `Abi_1_58` for `1.57`.

CC `@alexjg` (just in case I'm misinterpreting the code), CC #10772.

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix proc macro ABI version checks
Laurențiu Nicola [Thu, 18 Nov 2021 08:12:29 +0000 (10:12 +0200)]
Fix proc macro ABI version checks

2 years agoide: show go to for function hover return type
Jake Heinz [Thu, 18 Nov 2021 08:00:22 +0000 (08:00 +0000)]
ide: show go to for function hover return type

2 years agoide: display static values in hover
Jake Heinz [Thu, 18 Nov 2021 04:47:07 +0000 (04:47 +0000)]
ide: display static values in hover

2 years agoRemove unwrap in doc path resolution
John-John Tedro [Thu, 18 Nov 2021 04:19:58 +0000 (05:19 +0100)]
Remove unwrap in doc path resolution

2 years agoMerge #10785
bors[bot] [Thu, 18 Nov 2021 04:17:16 +0000 (04:17 +0000)]
Merge #10785

10785: ide: show const value in hover r=jhgg a=jhgg

fixes #10783

I think my original attempt was incorrect, because it looks like `HirDisplay` is used in more places than just the hover.

So, I've attempted it again in 312eafe, this time specifically just rendering the value in `hover::render`

pictoral:

![image](https://user-images.githubusercontent.com/5489149/142163890-b6aa2ab4-7bd0-4dd3-b35d-5eaa83fffb7f.png)

Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2 years agomore complicated const test
Jake Heinz [Thu, 18 Nov 2021 04:14:11 +0000 (04:14 +0000)]
more complicated const test

2 years agofix: parse the range pat inside the tuple pat
zhoufan [Thu, 18 Nov 2021 03:11:37 +0000 (11:11 +0800)]
fix: parse the range pat inside the tuple pat

2 years agoMerge #10789
bors[bot] [Wed, 17 Nov 2021 20:11:21 +0000 (20:11 +0000)]
Merge #10789

10789: internal: Check for derive attributes by item path, not `derive` identifier r=Veykril a=Veykril

Prior we only checked if an attribute is the exact `derive` identifier and nothing else to collect derive attributes. That means when we encounter the following:
```rs
#[::core::macros::builtin::derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ModPath {
    pub kind: PathKind,
    segments: Vec<Name>,
}
```
We won't actually expand the derive attributes, but instead we just expand the `derive` attribute with our dummy identity expander.

The changes here make it so we actually lookup the attribute path, check if it is the derive attribute and then collect the derives.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 17 Nov 2021 19:51:15 +0000 (20:51 +0100)]
Simplify

2 years agoCheck for derive attributes by item path, not `derive` identifier
Lukas Wirth [Wed, 17 Nov 2021 18:46:32 +0000 (19:46 +0100)]
Check for derive attributes by item path, not `derive` identifier

2 years agoApply suggestions from code review
Jake [Wed, 17 Nov 2021 17:53:24 +0000 (09:53 -0800)]
Apply suggestions from code review

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #10787
bors[bot] [Wed, 17 Nov 2021 14:55:18 +0000 (14:55 +0000)]
Merge #10787

10787: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 17 Nov 2021 14:30:12 +0000 (15:30 +0100)]
Simplify

2 years agoMerge #10786
bors[bot] [Wed, 17 Nov 2021 10:39:19 +0000 (10:39 +0000)]
Merge #10786

10786: minor: remove duplicate calls r=Veykril a=XFFXFF

`scopes.set_scope(*expr, scope)` is duplicate, because we always call it in `compute_expr_scopes`  https://github.com/rust-analyzer/rust-analyzer/blob/add6cccd4c923fbb5c83cc27b06aa84b2cbc9557/crates/hir_def/src/body/scope.rs#L175-L180

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agominor: remove duplicate calls
zhoufan [Wed, 17 Nov 2021 10:16:25 +0000 (18:16 +0800)]
minor: remove duplicate calls

2 years agomaybe this is better??
Jake Heinz [Wed, 17 Nov 2021 07:00:24 +0000 (07:00 +0000)]
maybe this is better??

2 years agohir: show const value in hover
Jake Heinz [Wed, 17 Nov 2021 05:49:27 +0000 (05:49 +0000)]
hir: show const value in hover

2 years agoMerge #10781
bors[bot] [Tue, 16 Nov 2021 20:51:09 +0000 (20:51 +0000)]
Merge #10781

10781: internal: Do not use reference search in `runnables::related_tests` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #10778
bors[bot] [Tue, 16 Nov 2021 20:33:58 +0000 (20:33 +0000)]
Merge #10778

10778: internal: Skip test/bench attr expansion in resolution instead of collection r=Veykril a=Veykril

This way we skip any path resolving to the test and bench attributes instead of just the lone identifiers(which could very well point to non-builtin attributes).
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDo not use reference search in runnables::related_tests
Lukas Wirth [Tue, 16 Nov 2021 20:32:02 +0000 (21:32 +0100)]
Do not use reference search in runnables::related_tests

2 years agoSimplify
Lukas Wirth [Tue, 16 Nov 2021 20:26:34 +0000 (21:26 +0100)]
Simplify

2 years agoSkip test/bench attr expansion in resolution instead of collection
Lukas Wirth [Tue, 16 Nov 2021 19:23:56 +0000 (20:23 +0100)]
Skip test/bench attr expansion in resolution instead of collection

2 years agoMerge #10775
bors[bot] [Tue, 16 Nov 2021 18:52:26 +0000 (18:52 +0000)]
Merge #10775

10775: minor: Simplify r=lnicola a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #10777
bors[bot] [Tue, 16 Nov 2021 18:44:04 +0000 (18:44 +0000)]
Merge #10777

10777: internal: Allow disabling perf access via `RA_DISABLE_PERF` r=lnicola a=jonas-schievink

https://github.com/rr-debugger/rr does not support the perf-specific ioctls, so add a way to avoid them.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoAllow disabling perf access via `RA_DISABLE_PERF`
Jonas Schievink [Tue, 16 Nov 2021 18:32:38 +0000 (19:32 +0100)]
Allow disabling perf access via `RA_DISABLE_PERF`

2 years agominor: Simplify
Lukas Wirth [Tue, 16 Nov 2021 12:25:23 +0000 (13:25 +0100)]
minor: Simplify

2 years agoMerge #10776
bors[bot] [Tue, 16 Nov 2021 18:18:47 +0000 (18:18 +0000)]
Merge #10776

10776: fix: Remove validation of `super` in use paths r=Veykril a=lnicola

Fixes #10770

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRemove validation of `super` in use paths
Laurențiu Nicola [Tue, 16 Nov 2021 17:59:36 +0000 (19:59 +0200)]
Remove validation of `super` in use paths

2 years agoMerge #10769
bors[bot] [Tue, 16 Nov 2021 16:40:51 +0000 (16:40 +0000)]
Merge #10769

10769: Add proc macro ABI for rustc 1.58 r=lnicola a=alexjg

This fixes #10766.

I do have some concerns here. The proc macro server API has added three methods to `TokenStream` which I don't really know how to implement in `RustcServer`. Namely `expand_expr`, `before`, and `after`. You'll see that these are currently `unimplemented!` in `crates/proc_macro_server/src/abis/abi_1_58/rustc_server.rs`. I don't have the expertise to fill in the blanks here, it may be necessary to pull in someone who knows a bit more about the proc macro crate.

I think this will only be a problem when actually attempting to expand a macro, so this is probably strictly better than not including the updated ABI at all.

Co-authored-by: Alex Good <alex@memoryandthought.me>
2 years agoAdd proc macro ABI for rustc 1.58
Alex Good [Mon, 15 Nov 2021 13:47:33 +0000 (13:47 +0000)]
Add proc macro ABI for rustc 1.58

2 years agoMerge #10734
bors[bot] [Tue, 16 Nov 2021 11:27:11 +0000 (11:27 +0000)]
Merge #10734

10734: fix: add generic parameters in convert to manual impl assist r=Veykril a=TheDoctor314

Fixes #10041.

Co-authored-by: TheDoctor314 <64731940+TheDoctor314@users.noreply.github.com>
2 years agoMerge #10774
bors[bot] [Tue, 16 Nov 2021 11:16:50 +0000 (11:16 +0000)]
Merge #10774

10774: minor: Lift out FxIndex{Map/Set} types into ide_db r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: Lift out FxIndex{Map/Set} types into ide_db
Lukas Wirth [Tue, 16 Nov 2021 11:15:47 +0000 (12:15 +0100)]
minor: Lift out FxIndex{Map/Set} types into ide_db

2 years agoMerge #10773
bors[bot] [Tue, 16 Nov 2021 10:52:31 +0000 (10:52 +0000)]
Merge #10773

10773: fix: Remove faulty logic for ascending test attributes for runnables r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Reimplement mapping out of test/bench attributes for runnables
Lukas Wirth [Tue, 16 Nov 2021 10:36:41 +0000 (11:36 +0100)]
fix: Reimplement mapping out of test/bench attributes for runnables

2 years agoFix `impl_def_from_trait`
TheDoctor314 [Mon, 15 Nov 2021 15:21:48 +0000 (20:51 +0530)]
Fix `impl_def_from_trait`

Revert "Fix `impl_trait` function to emit correct ast"

This reverts commit 55a4813151a8f36dcdb520c45a461fe5dfbed499.

Fix `impl_def_from_trait`

It now generates the correct `ast::Impl` using
`generate_trait_impl_text` and parses it to form the right node (copied
from the private fn 'make::ast_from_text').

2 years agoMerge #10767
bors[bot] [Sun, 14 Nov 2021 15:26:58 +0000 (15:26 +0000)]
Merge #10767

10767: minor: Rename intern_macro -> intern_macro_call r=Veykril a=Veykril

We potentially want to intern macro definitions so the names would probably collide
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRename intern_macro -> intern_macro_call
Lukas Wirth [Sun, 14 Nov 2021 15:25:40 +0000 (16:25 +0100)]
Rename intern_macro -> intern_macro_call

2 years agoMerge #10759
bors[bot] [Sun, 14 Nov 2021 12:05:17 +0000 (12:05 +0000)]
Merge #10759

10759: make `add_missing_match_arms` applicable at the end of the match r=Veykril a=rainy-me

close #10740

Co-authored-by: rainy-me <github@yue.coffee>
2 years agoadjust test case and stop deleting newline
rainy-me [Sun, 14 Nov 2021 11:56:28 +0000 (20:56 +0900)]
adjust test case and stop deleting newline

2 years agoMerge #10762
bors[bot] [Sun, 14 Nov 2021 09:20:59 +0000 (09:20 +0000)]
Merge #10762

10762: Fix: trigger flyimport on enum variants r=lnicola a=XFFXFF

fixes #10749

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agofix: flyimport triggers on enum variant declarations
zhoufan [Sun, 14 Nov 2021 04:16:21 +0000 (12:16 +0800)]
fix: flyimport triggers on enum variant declarations

2 years agoMerge #10761
bors[bot] [Sat, 13 Nov 2021 23:42:16 +0000 (23:42 +0000)]
Merge #10761

10761: inlay hints: add the option to always show constructor inlay hints r=Veykril a=jhgg

This PR adds a config to *disable* the functionality in #10441 - _and makes that functionality disabled by default._

I actually *really* like inlay hints always showing up, and it helps a lot as a teaching tool too, and also it's quite reassuring to know that r-a indeed understands the code I've written. This PR adds the option `rust-analyzer.inlayHints.hideNamedConstructorHints` (i can also invert this to be `rust-analyzer.inlayHints.showNamedConstructorHints`, just let me know.)

Co-authored-by: Jake Heinz <jh@discordapp.com>
2 years agoflip the default
Jake Heinz [Sat, 13 Nov 2021 23:39:34 +0000 (23:39 +0000)]
flip the default

2 years agoinlay hints: add the option to always show constructor inlay hints
Jake Heinz [Sat, 13 Nov 2021 23:12:29 +0000 (23:12 +0000)]
inlay hints: add the option to always show constructor inlay hints

2 years agoadd missing match arms end of last arm
rainy-me [Sat, 13 Nov 2021 17:32:10 +0000 (02:32 +0900)]
add missing match arms end of last arm

2 years agoMerge #10758
bors[bot] [Sat, 13 Nov 2021 15:56:25 +0000 (15:56 +0000)]
Merge #10758

10758: Update docs: include Gentoo source build r=lnicola a=mjkalyan

Mention the dev-util/rust-analyzer package for building from source.

Co-authored-by: mjkalyan <34904034+mjkalyan@users.noreply.github.com>
2 years agoUpdate docs: include Gentoo source build
mjkalyan [Sat, 13 Nov 2021 01:26:21 +0000 (18:26 -0700)]
Update docs: include Gentoo source build

Mention the dev-util/rust-analyzer package for building from source.

2 years agoMerge #10756
bors[bot] [Fri, 12 Nov 2021 21:05:54 +0000 (21:05 +0000)]
Merge #10756

10756: Allow the check command to terminate without output r=Veykril a=Wilfred

Cargo will always output something on success:

```
$ cargo check --message-format=json
{"reason":"compiler-artifact", ... snipped ... }
{"reason":"build-finished","success":true}
```

However, rustc does not output anything on success:

```
$ rustc --error-format=json main.rs
$ echo $?
0
```

Restore the behaviour prior to #10517, where an exit code of 0 is
considered good even if nothing is written to stdout.

This enables custom overrideCommand values that use rustc rather than
cargo.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2 years agoAllow the check command to terminate without output
Wilfred Hughes [Fri, 12 Nov 2021 19:43:20 +0000 (11:43 -0800)]
Allow the check command to terminate without output

Cargo will always output something on success:

```
$ cargo check --message-format=json
{"reason":"compiler-artifact", ... snipped ... }
{"reason":"build-finished","success":true}
```

However, rustc does not output anything on success:

```
$ rustc --error-format=json main.rs
$ echo $?
0
```

Restore the behaviour prior to #10517, where an exit code of 0 is
considered good even if nothing is written to stdout.

This enables custom overrideCommand values that use rustc rather than
cargo.

2 years agoMerge #10755
bors[bot] [Fri, 12 Nov 2021 19:32:04 +0000 (19:32 +0000)]
Merge #10755

10755: Fix type names in typescript sample code r=lnicola a=Wilfred

`bool` is Rust, whereas `boolean` is the type name in TypeScript.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2 years agoFix type names in typescript sample code
Wilfred Hughes [Fri, 12 Nov 2021 19:15:08 +0000 (11:15 -0800)]
Fix type names in typescript sample code

2 years agoMerge #10747
bors[bot] [Thu, 11 Nov 2021 17:48:45 +0000 (17:48 +0000)]
Merge #10747

10747: fix: Remove faulty logic for ascending test attributes for runnables r=Veykril a=Veykril

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

- This logic is currently not required as we do not expand test/bench anymore for the time being
- The implementation of this was flawed to begin with as it just skipped out of macro expansions instead of ascending the trees inside expansions

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRemove faulty logic for ascending test attributes for runnables
Lukas Wirth [Thu, 11 Nov 2021 17:47:24 +0000 (18:47 +0100)]
Remove faulty logic for ascending test attributes for runnables

2 years agoMerge #10745
bors[bot] [Thu, 11 Nov 2021 17:21:37 +0000 (17:21 +0000)]
Merge #10745

10745: internal: Replace some more ide usages of ModuleDef with Definition r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoReplace some more ide usages of ModuleDef with Definition
Lukas Wirth [Thu, 11 Nov 2021 17:20:54 +0000 (18:20 +0100)]
Replace some more ide usages of ModuleDef with Definition

2 years agoMerge #10743
bors[bot] [Thu, 11 Nov 2021 13:45:20 +0000 (13:45 +0000)]
Merge #10743

10743: feat: index fewer crates on startup/reload r=jonas-schievink a=jonas-schievink

Before this PR, we used to index every crate in the `CrateGraph`, which includes every test, benchmark and example of all packages everywhere. The point of indexing is to speed up future queries, so indexing lots of tiny crates users are unlikely to open isn't really helpful.

This PR instead makes us index only the transitive dependencies of all workspace crates.

This reduces the number of crates we index in the rust-analyzer repo from 617 to 177 (!). Time is not impacted by that much, because most of the skipped crates are tiny.

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoPrime a more reasonable set of crates
Jonas Schievink [Thu, 11 Nov 2021 13:39:20 +0000 (14:39 +0100)]
Prime a more reasonable set of crates

2 years agoFix `impl_trait` function to emit correct ast
TheDoctor314 [Thu, 11 Nov 2021 08:46:59 +0000 (14:16 +0530)]
Fix `impl_trait` function to emit correct ast

`impl_trait` code copied from `generate_impl_text_inner` to properly
handle the bounds for the generic parameters.

2 years agoAdd generic bounds in test
TheDoctor314 [Thu, 11 Nov 2021 08:46:29 +0000 (14:16 +0530)]
Add generic bounds in test

2 years agoMerge #10741
bors[bot] [Wed, 10 Nov 2021 23:19:44 +0000 (23:19 +0000)]
Merge #10741

10741: internal: Flatten Definition::ModuleDef variant r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Flatten `Definition::ModuleDef` variant
Lukas Wirth [Wed, 10 Nov 2021 21:02:50 +0000 (22:02 +0100)]
internal: Flatten `Definition::ModuleDef` variant

2 years agoMerge #10689
bors[bot] [Wed, 10 Nov 2021 21:08:51 +0000 (21:08 +0000)]
Merge #10689

10689: Handle pub tuple fields in tuple structs r=Veykril a=adamrk

The current implementation will throw a parser error for tuple structs
that contain a pub tuple field. For example,
```rust
struct Foo(pub (u32, u32));
```
is valid Rust, but rust-analyzer will throw a parser error.  This is
because the parens after `pub` is treated as a visibility context.
Allowing a tuple type to follow `pub` in the special case when we are
defining fields in a tuple struct can fix the issue.

I guess this is a really minor case because there's not much reason
for having a tuple type within a struct tuple, but it is valid rust syntax...

Co-authored-by: Adam Bratschi-Kaye <ark.email@gmail.com>
2 years agoHandle pub tuple fields in tuple structs
Adam Bratschi-Kaye [Wed, 3 Nov 2021 22:57:46 +0000 (23:57 +0100)]
Handle pub tuple fields in tuple structs

The current implementation will throw a parser error for tuple structs
that contain a pub tuple field. For example,
```rust
struct Foo(pub (u32, u32));
```
is valid Rust, but rust-analyzer will throw a parser error.  This is
because the parens after `pub` is treated as a visibility context.
Allowing a tuple type to follow `pub` in the special case when we are
defining fields in a tuple struct can fix the issue.

2 years agoMerge #10739
bors[bot] [Wed, 10 Nov 2021 17:27:24 +0000 (17:27 +0000)]
Merge #10739

10739: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 10 Nov 2021 16:33:35 +0000 (17:33 +0100)]
Simplify

2 years agoMerge #10729
bors[bot] [Wed, 10 Nov 2021 16:47:35 +0000 (16:47 +0000)]
Merge #10729

10729: Fix: Lookup impls in local def maps r=jonas-schievink a=XFFXFF

fixes #10676

Co-authored-by: zhoufan <1247714429@qq.com>
2 years agoMerge #10738
bors[bot] [Wed, 10 Nov 2021 15:12:05 +0000 (15:12 +0000)]
Merge #10738

10738: internal: Do not search through all three namespaces in `ItemScope::name_of` r=Veykril a=Veykril

Brings down `5ms - find_path_prefixed (46 calls)` to `1ms - find_path_prefixed (46 calls)` for me on the `integrated_completion_benchmark`.
Still `O(n)` but this should considerably cut down lookups nevertheless(as shown by the timings already).
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDo not search through all three namespaces in `ItemScope::name_of`
Lukas Wirth [Wed, 10 Nov 2021 15:06:16 +0000 (16:06 +0100)]
Do not search through all three namespaces in `ItemScope::name_of`

2 years agoAdd generic parameters for manual impl assist
TheDoctor314 [Mon, 8 Nov 2021 15:49:22 +0000 (21:19 +0530)]
Add generic parameters for manual impl assist

The `impl_trait` function takes an optional `GenericParamList` to create
the trait impl.

2 years agoAdd failing tests for generic struct
TheDoctor314 [Mon, 1 Nov 2021 16:47:27 +0000 (22:17 +0530)]
Add failing tests for generic struct

2 years agoMerge #10731
bors[bot] [Tue, 9 Nov 2021 22:11:32 +0000 (22:11 +0000)]
Merge #10731

10731: fix: show the right check-command r=Veykril a=Florian-Schoenherr

Currenty r.a. only shows this:
![image](https://user-images.githubusercontent.com/65456722/140977478-e6bc8a45-7c25-4578-9406-fb34f1eb0792.png)
even if another command was specified

There might be a better way to do this, I tried.

Co-authored-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>
2 years agofix: show the right check-command
Florian-Schoenherr [Tue, 9 Nov 2021 20:52:55 +0000 (21:52 +0100)]
fix: show the right check-command

Signed-off-by: Florian-Schoenherr <florian.schoenherr99@gmail.com>
2 years agoMerge #10732
bors[bot] [Tue, 9 Nov 2021 18:06:23 +0000 (18:06 +0000)]
Merge #10732

10732: minor: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump chalk
Laurențiu Nicola [Tue, 9 Nov 2021 18:05:04 +0000 (20:05 +0200)]
Bump chalk

2 years agoBump libc and paste
Laurențiu Nicola [Tue, 9 Nov 2021 18:03:48 +0000 (20:03 +0200)]
Bump libc and paste

2 years agolookup impls in local del maps
zhoufan [Tue, 9 Nov 2021 10:13:42 +0000 (18:13 +0800)]
lookup impls in local del maps

2 years agoMerge #10726
bors[bot] [Mon, 8 Nov 2021 18:42:10 +0000 (18:42 +0000)]
Merge #10726

10726: minor: Add some completion profile spans r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd some completion profile spans
Lukas Wirth [Mon, 8 Nov 2021 18:41:16 +0000 (19:41 +0100)]
Add some completion profile spans

2 years agoMerge #10722
bors[bot] [Mon, 8 Nov 2021 14:08:49 +0000 (14:08 +0000)]
Merge #10722

10722: fix: Fix proc-macro attributes being shadowed by their functions in IDE layer r=Veykril a=Veykril

We sometimes still didn't resolve proc-macro attrs in attribute paths in the ide crates due to their function definitions resolving first.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoFix proc-macro attributes being shadowed by their functions in IDE layer
Lukas Wirth [Mon, 8 Nov 2021 13:31:46 +0000 (14:31 +0100)]
Fix proc-macro attributes being shadowed by their functions in IDE layer

2 years agoMerge #10688
bors[bot] [Mon, 8 Nov 2021 13:37:34 +0000 (13:37 +0000)]
Merge #10688

10688: internal: Type-check TS on CI and also turn off the strict setting `useUnknownInCatchVariables` r=lnicola a=ChayimFriedman2

We don't follow it and I found that turning it on will have little benefit.

I'm not sure if we should also type-check when building in launch.json.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2 years agoMerge #10720
bors[bot] [Mon, 8 Nov 2021 13:12:03 +0000 (13:12 +0000)]
Merge #10720

10720: fix: Don't ascribe types in pattern completion for param patterns twice r=Veykril a=Veykril

Fixes #10323
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAdd test for current incorrect behaviour
Lukas Wirth [Mon, 8 Nov 2021 13:10:26 +0000 (14:10 +0100)]
Add test for current incorrect behaviour