]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAvoid autoderef coercions leaking if they don't apply
Florian Diebold [Fri, 25 Feb 2022 14:46:02 +0000 (15:46 +0100)]
Avoid autoderef coercions leaking if they don't apply

2 years agoFix unreachable pub
Florian Diebold [Fri, 25 Feb 2022 11:09:49 +0000 (12:09 +0100)]
Fix unreachable pub

2 years agoRefactor autoderef and method resolution
Florian Diebold [Wed, 16 Feb 2022 16:44:03 +0000 (17:44 +0100)]
Refactor autoderef and method resolution

 - don't return the receiver type from method resolution; instead just
 return the autorefs/autoderefs that happened and repeat them. This
 ensures all the effects like trait obligations and whatever we learned
 about type variables from derefing them are actually applied. Also, it
 allows us to get rid of `decanonicalize_ty`, which was just wrong in
 principle.

 - Autoderef itself now directly works with an inference table. Sadly
 this has the effect of making it harder to use as an iterator, often
 requiring manual `while let` loops. (rustc works around this by using
 inner mutability in the inference context, so that things like unifying
 types don't require a unique reference.)

 - We now record the adjustments (autoref/deref) for method receivers
 and index expressions, which we didn't before.

 - Removed the redundant crate parameter from method resolution, since
 the trait_env contains the crate as well.

 - in the HIR API, the methods now take a scope to determine the trait env.
 `Type` carries a trait env, but I think that's probably a bad decision
 because it's easy to create it with the wrong env, e.g. by using
 `Adt::ty`. This mostly didn't matter so far because
 `iterate_method_candidates` took a crate parameter and ignored
 `self.krate`, but the trait env would still have been wrong in those
 cases, which I think would give some wrong results in some edge cases.

Fixes #10058.

2 years agoAdd some tests
Florian Diebold [Sun, 5 Sep 2021 14:40:46 +0000 (16:40 +0200)]
Add some tests

2 years agoMerge #11462
bors[bot] [Thu, 24 Feb 2022 20:59:27 +0000 (20:59 +0000)]
Merge #11462

11462: 11422 highlight continue and break r=Veykril a=HansAuger

Closes #11422

Co-authored-by: Moritz Vetter <mv@3yourmind.com>
2 years agorefactor(11422): make number unsigned, nest enums into each other
Moritz Vetter [Thu, 24 Feb 2022 20:29:26 +0000 (21:29 +0100)]
refactor(11422): make number unsigned, nest enums into each other

2 years agofix(11422): have two different funuctions - one for iterating breaks, one for iteraat...
Moritz Vetter [Thu, 24 Feb 2022 17:56:08 +0000 (18:56 +0100)]
fix(11422): have two different funuctions - one for iterating breaks, one for iteraating breaks and continues

2 years agoadd logic to highlight continue and break keywords according to expectations
Moritz Vetter [Sun, 13 Feb 2022 11:48:04 +0000 (12:48 +0100)]
add logic to highlight continue and break keywords according to expectations

2 years agorefactor helper function to work with function taking expression enum instead of...
Moritz Vetter [Sun, 13 Feb 2022 11:04:51 +0000 (12:04 +0100)]
refactor helper function to work with function taking expression enum instead of break expression

2 years agoadd some breaking tests (TDD - style)
Moritz Vetter [Sun, 13 Feb 2022 03:05:52 +0000 (04:05 +0100)]
add some breaking tests (TDD - style)

2 years agoMerge #11531
bors[bot] [Thu, 24 Feb 2022 12:57:51 +0000 (12:57 +0000)]
Merge #11531

11531: fix: Make fill_match_arms assist handle doc(hidden) and non_exhaustive r=Veykril a=OleStrohm

Fixes #11499
Fixes #11500
This keeps track of the relevant attributes and adds in a wildcard pat at the end of the match when necessary.

I decided to do them in the same PR since they both needed the ability to add a wildcard arm, and so their changes would overlap if done separately, but I'll split them up if that seems better.

This is my first PR to rust-analyzer, so all feedback is greatly appreciated!

Co-authored-by: Ole Strohm <strohm99@gmail.com>
2 years agoMerge #11540
bors[bot] [Thu, 24 Feb 2022 11:25:18 +0000 (11:25 +0000)]
Merge #11540

11540: fix: Resolve private fields in type inference r=flodiebold a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10253#issuecomment-920962927
(the same issue probably exists for method calls, but I think fixing that might be trickier)

Visibility checks were introduced in https://github.com/rust-analyzer/rust-analyzer/issues/7841 for autoderef to work properly, so now we just record the first field we find unconditionally, and then overwrite it if autoderef manages to find another field in a later cycle.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11545
bors[bot] [Thu, 24 Feb 2022 10:14:36 +0000 (10:14 +0000)]
Merge #11545

11545: add `is_slice` method to `hir::Type` r=flodiebold a=nerdypepper

would like to have this on `hir::Type` for a small project i am working on, unless there is another way to check if `hir::Type` is a slice primitive?

Co-authored-by: Akshay <nerdy@peppe.rs>
2 years agoadd `is_slice` method to `hir::Type`
Akshay [Thu, 24 Feb 2022 09:50:12 +0000 (15:20 +0530)]
add `is_slice` method to `hir::Type`

2 years agoIgnore doc(hidden) for crate-local enums
Ole Strohm [Wed, 23 Feb 2022 18:08:18 +0000 (18:08 +0000)]
Ignore doc(hidden) for crate-local enums

2 years agofix: Resolve private fields in type inference
Lukas Wirth [Wed, 23 Feb 2022 15:45:58 +0000 (16:45 +0100)]
fix: Resolve private fields in type inference

2 years agoSimplify
Lukas Wirth [Wed, 23 Feb 2022 15:29:33 +0000 (16:29 +0100)]
Simplify

2 years agoMerge #11539
bors[bot] [Wed, 23 Feb 2022 15:05:22 +0000 (15:05 +0000)]
Merge #11539

11539: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 23 Feb 2022 14:55:06 +0000 (15:55 +0100)]
Simplify

2 years agoMerge #11537
bors[bot] [Wed, 23 Feb 2022 11:01:06 +0000 (11:01 +0000)]
Merge #11537

11537: internal: Reduce visibility of proc-macros to pub(crate) r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoReduce visibility of proc-macros to pub(crate)
Lukas Wirth [Wed, 23 Feb 2022 10:57:11 +0000 (11:57 +0100)]
Reduce visibility of proc-macros to pub(crate)

2 years agoMerge #11536
bors[bot] [Wed, 23 Feb 2022 10:32:15 +0000 (10:32 +0000)]
Merge #11536

11536: internal: Resolve functions as proc-macros via `FileAstId` r=Veykril a=Veykril

cc https://github.com/rust-analyzer/rust-analyzer/issues/11528
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoResolve functions as proc-macros via FileAstId
Lukas Wirth [Wed, 23 Feb 2022 10:21:46 +0000 (11:21 +0100)]
Resolve functions as proc-macros via FileAstId

2 years agoMerge #11535
bors[bot] [Wed, 23 Feb 2022 07:59:13 +0000 (07:59 +0000)]
Merge #11535

11535: Add Kakoune and Helix configuration r=lnicola a=woshilapin

Follow-up of https://github.com/rust-analyzer/rust-analyzer.github.io/pull/181
Fixes https://github.com/rust-analyzer/rust-analyzer.github.io/pull/180

cc `@lnicola`

Co-authored-by: Jean SIMARD <woshilapin@tuziwo.info>
2 years agoAdd Kakoune and Helix configuration
Jean SIMARD [Wed, 23 Feb 2022 07:55:16 +0000 (08:55 +0100)]
Add Kakoune and Helix configuration

Follow-up of rust-analyzer/rust-analyser.github.io#181
Fixes rust-analyzer/rust-analyser.github.io#180

2 years agoMerge #11534
bors[bot] [Wed, 23 Feb 2022 04:39:42 +0000 (04:39 +0000)]
Merge #11534

11534: minor: Improve instructions for running pre-release versions r=lnicola a=lnicola

Closes #11468

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRemove reference to updates.channel from settings
Laurențiu Nicola [Wed, 23 Feb 2022 04:38:01 +0000 (06:38 +0200)]
Remove reference to updates.channel from settings

2 years agoRephrase nightly instructions in the manual
Laurențiu Nicola [Wed, 23 Feb 2022 04:37:16 +0000 (06:37 +0200)]
Rephrase nightly instructions in the manual

2 years agoAdded test
Ole Strohm [Tue, 22 Feb 2022 22:48:44 +0000 (22:48 +0000)]
Added test

2 years agoDedup code
Ole Strohm [Tue, 22 Feb 2022 22:41:03 +0000 (22:41 +0000)]
Dedup code

2 years agoMerge #11461
bors[bot] [Tue, 22 Feb 2022 18:46:12 +0000 (18:46 +0000)]
Merge #11461

11461: Extract struct from enum variant filters generics r=jo-goro a=jo-goro

Fixes #11452.

This PR updates extract_struct_from_enum_variant. Extracting a struct `A` form an enum like
```rust
enum X<'a, 'b> {
    A { a: &'a () },
    B { b: &'b () },
}
```
will now be correctly generated as
```rust
struct A<'a> { a: &'a () }

enum X<'a, 'b> {
    A(A<'a>),
    B { b: &'b () },
}
```
instead of the previous
```rust
struct A<'a, 'b>{ a: &'a () } // <- should not have 'b

enum X<'a, 'b> {
    A(A<'a, 'b>),
    B { b: &'b () },
}
```

This also works for generic type parameters and const generics.

Bounds are also copied, however I have not yet implemented a filter for unneeded bounds. Extracting `B` from the following enum
```rust
enum X<'a, 'b: 'a> {
    A { a: &'a () },
    B { b: &'b () },
}
```
will be generated as
```rust
struct B<'b: 'a> { b: &'b () } // <- should be `struct B<'b> { b: &'b () }`

enum X<'a, 'b: 'a> {
    A { a: &'a () },
    B(B<'b>),
}
```

Extracting bounds with where clauses is also still not implemented.

Co-authored-by: Jonas Goronczy <goronczy.jonas@gmail.com>
2 years agoReplaced fold with for loop
Jonas Goronczy [Tue, 22 Feb 2022 18:38:34 +0000 (19:38 +0100)]
Replaced fold with for loop

2 years agoMerge #11472
bors[bot] [Tue, 22 Feb 2022 18:12:27 +0000 (18:12 +0000)]
Merge #11472

11472: fix: visibility in impl items and pub(crate) to pub in extract_module r=feniljain a=feniljain

Should fix #11007 and #11443

Makes following changes:

- Removes visiblity modifiers from trait items
- Respect user given visibility
- Updated tests for the same

Co-authored-by: vi_mi <fkjainco@gmail.com>
Co-authored-by: vi_mi <49019259+feniljain@users.noreply.github.com>
2 years agochore: reposition comment
vi_mi [Tue, 22 Feb 2022 14:16:50 +0000 (19:46 +0530)]
chore: reposition comment

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Make match_arms assist handle doc(hidden) and non_exhaustive
Ole Strohm [Tue, 22 Feb 2022 13:59:30 +0000 (13:59 +0000)]
fix: Make match_arms assist handle doc(hidden) and non_exhaustive

2 years agofix: visibility in impl items and pub(crate) to pub in extract_module
vi_mi [Tue, 22 Feb 2022 13:02:36 +0000 (18:32 +0530)]
fix: visibility in impl items and pub(crate) to pub in extract_module

2 years agoMerge #11530
bors[bot] [Tue, 22 Feb 2022 11:33:32 +0000 (11:33 +0000)]
Merge #11530

11530: fix: Fix expand_macro always expanding the first listed derive r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix expand_macro always expanding the first listed derive
Lukas Wirth [Tue, 22 Feb 2022 11:32:15 +0000 (12:32 +0100)]
fix: Fix expand_macro always expanding the first listed derive

2 years agoMerge #11513
bors[bot] [Tue, 22 Feb 2022 10:12:30 +0000 (10:12 +0000)]
Merge #11513

11513: internal: Expand the derive attribute into a pseudo expansion r=Veykril a=Veykril

Quoting my comment:

> We generate a very specific expansion here, as we do not actually expand the `#[derive]` attribute
> itself in name res, but we do want to expand it to something for the IDE layer, so that the input
> derive attributes can be downmapped, and resolved as proper paths.
> This is basically a hack, that simplifies the hacks we need in a lot of ide layer places to
> somewhat inconsistently resolve derive attributes.
>
> As such, we expand `#[derive(Foo, bar::Bar)]` into
> ```
>  #[Foo]
>  #[bar::Bar]
>  ();
> ```
> which allows fallback path resolution in hir::Semantics to properly identify our derives.
> Since we do not expand the attribute in nameres though, we keep the original item.
>
> The ideal expansion here would be for the `#[derive]` to re-emit the annotated item and somehow
> use the input paths in its output as well.
> But that would bring two problems with it, for one every derive would duplicate the item token tree
> wasting a lot of memory, and it would also require some way to use a path in a way that makes it
> always resolve as a derive without nameres recollecting them.
> So this hacky approach is a lot more friendly for us, though it does require a bit of support in
> [`hir::Semantics`] to make this work.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoupdate references::derive test output
Lukas Wirth [Tue, 22 Feb 2022 09:52:35 +0000 (10:52 +0100)]
update references::derive test output

2 years agosimplify and document
Lukas Wirth [Tue, 22 Feb 2022 09:45:29 +0000 (10:45 +0100)]
simplify and document

2 years agoSimplify
Lukas Wirth [Mon, 21 Feb 2022 12:34:05 +0000 (13:34 +0100)]
Simplify

2 years agoFix syntax highlighting not highlighting derives anymore
Lukas Wirth [Mon, 21 Feb 2022 12:21:25 +0000 (13:21 +0100)]
Fix syntax highlighting not highlighting derives anymore

2 years agoMake replace_derive_with_manual_impl work again
Lukas Wirth [Mon, 21 Feb 2022 11:57:57 +0000 (12:57 +0100)]
Make replace_derive_with_manual_impl work again

2 years agoFix `expand_macro` not working for derive attributes
Lukas Wirth [Mon, 21 Feb 2022 10:51:53 +0000 (11:51 +0100)]
Fix `expand_macro` not working for derive attributes

2 years agointernal: Expand the derive attribute into a pseudo expansion
Lukas Wirth [Mon, 21 Feb 2022 01:42:58 +0000 (02:42 +0100)]
internal: Expand the derive attribute into a pseudo expansion

2 years agoMerge #11527
bors[bot] [Tue, 22 Feb 2022 09:08:22 +0000 (09:08 +0000)]
Merge #11527

11527: internal: Split unresolve proc-macro error out of mbe r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Split unresolve proc-macro error out of mbe
Lukas Wirth [Mon, 21 Feb 2022 18:14:06 +0000 (19:14 +0100)]
internal: Split unresolve proc-macro error out of mbe

2 years agoMerge #11525
bors[bot] [Tue, 22 Feb 2022 08:56:34 +0000 (08:56 +0000)]
Merge #11525

11525: fix(assist): Drop generic args in path before insert use in `replace_qualified_name_with_use` r=Veykril a=tysg

Fixes #11505. also removed an unnecessary `clone_for_update` call.

Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2 years agoMerge #11524
bors[bot] [Tue, 22 Feb 2022 08:38:57 +0000 (08:38 +0000)]
Merge #11524

11524: doc: state that only the latest stable toolchain is supported r=lnicola a=jtroo

This closes #11226. The content seemed to make more sense in the
installation section as opposed to the Troubleshooting section.

Co-authored-by: Jan Tache <j.andreitabs@gmail.com>
2 years agoDrop generic args in path before insert use
Tianyi Song [Fri, 28 Jan 2022 08:15:23 +0000 (16:15 +0800)]
Drop generic args in path before insert use

2 years agoChange Rust Analyzer->rust-analyzer to match style
Jan Tache [Tue, 22 Feb 2022 07:01:05 +0000 (23:01 -0800)]
Change Rust Analyzer->rust-analyzer to match style

2 years agodoc: state that only the latest stable toolchain is supported
Jan Tache [Tue, 22 Feb 2022 06:37:19 +0000 (22:37 -0800)]
doc: state that only the latest stable toolchain is supported

This closes #11226. The content seemed to make more sense in the
installation section as opposed to the Troubleshooting section.

2 years agoRemoves ExtractedGenerics struct
Jonas Goronczy [Mon, 21 Feb 2022 22:00:16 +0000 (23:00 +0100)]
Removes ExtractedGenerics struct

2 years agoMerge #11490
bors[bot] [Mon, 21 Feb 2022 21:57:44 +0000 (21:57 +0000)]
Merge #11490

11490: Correctly fix formatting doc tests with generics r=Veykril a=KarlWithK

Before the doc_test would be outputted like this:
```zsh
"Foo<T, U>::t"
```
However, this would cause problems with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under quotes as so:
```zsh
"\"Foo<T, U>::t\""
```

Note:
At the cost of adding this, I had to allocate a new string via
`format!{}`. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:
```
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
```

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

Co-authored-by: KarlWithK <jocelinc60@outlook.com>
Co-authored-by: SeniorMars <jocelinc60@outlook.com>
2 years agoUpdate crates/ide/src/runnables.rs
SeniorMars [Mon, 21 Feb 2022 21:23:09 +0000 (15:23 -0600)]
Update crates/ide/src/runnables.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoCleanup
Jonas Goronczy [Mon, 21 Feb 2022 18:51:09 +0000 (19:51 +0100)]
Cleanup

2 years agoMerge #11522
bors[bot] [Mon, 21 Feb 2022 17:08:19 +0000 (17:08 +0000)]
Merge #11522

11522: fix: Make code lenses work on attributed items r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Make code lenses work on attributed items
Lukas Wirth [Mon, 21 Feb 2022 17:07:47 +0000 (18:07 +0100)]
fix: Make code lenses work on attributed items

2 years agoMerge #11455
bors[bot] [Mon, 21 Feb 2022 16:56:37 +0000 (16:56 +0000)]
Merge #11455

11455: Handle proc-macro functions as the proc-macro they resolve to r=Veykril a=Veykril

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

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMove fn to proc-macro conversion to name classification
Lukas Wirth [Mon, 21 Feb 2022 16:56:11 +0000 (17:56 +0100)]
Move fn to proc-macro conversion to name classification

2 years agoMerge #11481
bors[bot] [Mon, 21 Feb 2022 13:08:31 +0000 (13:08 +0000)]
Merge #11481

11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj

Implements #11474

The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier.

I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work.

Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2 years agoMerge #11517
bors[bot] [Mon, 21 Feb 2022 12:52:11 +0000 (12:52 +0000)]
Merge #11517

11517: fix: Fix qualfiied record literal completion triggering too eagerly r=Veykril a=Veykril

Supercedes https://github.com/rust-analyzer/rust-analyzer/pull/10909
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10889
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix qualfiied record literal completion triggering too eagerly
Lukas Wirth [Mon, 21 Feb 2022 12:50:16 +0000 (13:50 +0100)]
fix: Fix qualfiied record literal completion triggering too eagerly

2 years agoMerge #11516
bors[bot] [Mon, 21 Feb 2022 12:44:10 +0000 (12:44 +0000)]
Merge #11516

11516: fix: Don't count commas when looking for the derive attribute in diagnostics r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Don't count commas when looking for the derive attribute in diagnostics
Lukas Wirth [Mon, 21 Feb 2022 12:43:42 +0000 (13:43 +0100)]
fix: Don't count commas when looking for the derive attribute in diagnostics

2 years agoparameters.split_last()
Jeroen Vannevel [Mon, 21 Feb 2022 10:29:38 +0000 (10:29 +0000)]
parameters.split_last()

2 years agoMerge #11142
bors[bot] [Mon, 21 Feb 2022 10:29:16 +0000 (10:29 +0000)]
Merge #11142

11142: Updated the Sublime Text section r=Veykril a=AmjadHD

rust-analyzer/rust-analyzer.github.io#160

Co-authored-by: Amjad Ben Hedhili <amjadhedhili@outlook.com>
2 years agoMerge #11424
bors[bot] [Mon, 21 Feb 2022 10:21:39 +0000 (10:21 +0000)]
Merge #11424

11424: Pass required features to cargo when using run action r=Veykril a=WaffleLapkin

When using `F1`->`Rust Analyzer: Run` action on an `example`, pass its `required-features` to `cargo run`. This allows to run examples that were otherwise impossible to run with RA.

Co-authored-by: Maybe Waffle <waffle.lapkin@gmail.com>
2 years agoMerge #11375
bors[bot] [Mon, 21 Feb 2022 09:31:38 +0000 (09:31 +0000)]
Merge #11375

11375: feat: Support if- and while- let chains r=Veykril a=ChayimFriedman2

Closes #11320.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2 years agoMerge #11514
bors[bot] [Mon, 21 Feb 2022 09:23:20 +0000 (09:23 +0000)]
Merge #11514

11514: chore(manual): update coc-rust-analyzer manual r=Veykril a=fannheyward

Semantic tokens highlighting is added in coc.nvim now.

Co-authored-by: Heyward Fann <fannheyward@users.noreply.github.com>
2 years agoChange `single_let()` and `is_pattern_cond()` to free functions
Chayim Refael Friedman [Mon, 21 Feb 2022 06:15:21 +0000 (08:15 +0200)]
Change `single_let()` and `is_pattern_cond()` to free functions

2 years agoUpgrade ungrammar to 1.15.0
Chayim Refael Friedman [Tue, 1 Feb 2022 09:35:36 +0000 (11:35 +0200)]
Upgrade ungrammar to 1.15.0

2 years agoValidate `let` expressions
Chayim Refael Friedman [Sun, 30 Jan 2022 10:23:36 +0000 (12:23 +0200)]
Validate `let` expressions

Emit an error if they're found in an invalid position.

2 years agoUpdate tests
Chayim Refael Friedman [Mon, 24 Jan 2022 02:50:07 +0000 (04:50 +0200)]
Update tests

Unfortunately, we lost some recovery for expressions.

2 years agoFix various IDE features
Chayim Refael Friedman [Sun, 23 Jan 2022 22:37:59 +0000 (00:37 +0200)]
Fix various IDE features

As a side benefit, we got `let` guard support for `move_guard` for free.

2 years agoType-inference for `let` expressions
Chayim Refael Friedman [Sun, 23 Jan 2022 03:59:35 +0000 (05:59 +0200)]
Type-inference for `let` expressions

2 years agoLower `let` expressions
Chayim Refael Friedman [Sun, 23 Jan 2022 03:39:26 +0000 (05:39 +0200)]
Lower `let` expressions

2 years agoParse `let` expressions in order to support `let` chains
Chayim Refael Friedman [Sun, 23 Jan 2022 02:21:09 +0000 (04:21 +0200)]
Parse `let` expressions in order to support `let` chains

We still need to reject freestanding `let` expressions: see https://github.com/rust-analyzer/rust-analyzer/issues/11320#issuecomment-1018212465.

2 years agochore(manual): update coc-rust-analyzer manual
Heyward Fann [Mon, 21 Feb 2022 03:04:39 +0000 (11:04 +0800)]
chore(manual): update coc-rust-analyzer manual

Semantic tokens highlighting is added now

2 years agoMerge #11512
bors[bot] [Sun, 20 Feb 2022 23:16:59 +0000 (23:16 +0000)]
Merge #11512

11512: internal: Remove `name` fields from `MacroCallKind` r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Remove name fields from MacroCallKind
Lukas Wirth [Sun, 20 Feb 2022 23:02:10 +0000 (00:02 +0100)]
internal: Remove name fields from MacroCallKind

2 years agoMerge #11511
bors[bot] [Sun, 20 Feb 2022 21:54:12 +0000 (21:54 +0000)]
Merge #11511

11511: internal: Wrap MacroCallKind::Attr attr_args field in an Arc r=Veykril a=Veykril

This is stored in `MacroCallLoc` which is returned from a query, so cloning should be made cheap.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Wrap MacroCallKind::Attr attr_args field in an Arc
Lukas Wirth [Sun, 20 Feb 2022 21:53:04 +0000 (22:53 +0100)]
internal: Wrap MacroCallKind::Attr attr_args field in an Arc

2 years agoMerge #11504
bors[bot] [Sat, 19 Feb 2022 10:09:22 +0000 (10:09 +0000)]
Merge #11504

11504: Fix a typo in server_capabilities.experimental r=lnicola a=nemethf

Commit 27c4be6b4f68 wasn't really complex, but I still managed to make a mistake there, which this PR fixes.  Sorry.

Co-authored-by: Felicián Németh <felician.nemeth@gmail.com>
2 years agoFix a typo in server_capabilities.experimental
Felicián Németh [Sat, 19 Feb 2022 09:58:10 +0000 (10:58 +0100)]
Fix a typo in server_capabilities.experimental

2 years agoMerge #11498
bors[bot] [Fri, 18 Feb 2022 17:32:36 +0000 (17:32 +0000)]
Merge #11498

11498: minor: Update issue template r=lnicola a=lnicola

 - remove fixed #11098
 - ask about settings and environment variables

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoUpdate issue template
Laurențiu Nicola [Fri, 18 Feb 2022 17:30:15 +0000 (19:30 +0200)]
Update issue template

2 years agore-added FIXME
Jeroen Vannevel [Fri, 18 Feb 2022 09:12:52 +0000 (09:12 +0000)]
re-added FIXME

2 years agoCorrectly fix formatting doc tests with generics
KarlWithK [Fri, 18 Feb 2022 02:27:37 +0000 (20:27 -0600)]
Correctly fix formatting doc tests with generics

Before the doc_test would be outputted like this:
"Foo<T, U>::t"
However, this would cause shells with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under escape
chanters as so:
"\"Foo<T, U>::t\""

Note:
At the cost of adding this, I had to allocate a new string via
format!{}. However, I argue this is alright as this for just for
outputting the name of the doc test.

The following tests have been changed:
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl

2 years agoMerge #11484
bors[bot] [Wed, 16 Feb 2022 15:13:54 +0000 (15:13 +0000)]
Merge #11484

11484: Infer the array size for slice patterns r=flodiebold a=ChayimFriedman2

Fixes #11478 (feat or fix?),

I don't know much about the type-checking in RA, so maybe I did some obvious mistake.

Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
2 years agoInfer the array size for slice patterns
Chayim Refael Friedman [Wed, 16 Feb 2022 11:21:21 +0000 (11:21 +0000)]
Infer the array size for slice patterns

2 years agoremoved double map
Jeroen Vannevel [Tue, 15 Feb 2022 19:37:24 +0000 (19:37 +0000)]
removed double map

2 years agosimplified write
Jeroen Vannevel [Tue, 15 Feb 2022 19:27:56 +0000 (19:27 +0000)]
simplified write

2 years agotest names
Jeroen Vannevel [Tue, 15 Feb 2022 19:22:36 +0000 (19:22 +0000)]
test names

2 years agoadd test for function pointer without identifier
Jeroen Vannevel [Tue, 15 Feb 2022 19:20:50 +0000 (19:20 +0000)]
add test for function pointer without identifier

2 years agouse Name instead of String
Jeroen Vannevel [Tue, 15 Feb 2022 19:12:23 +0000 (19:12 +0000)]
use Name instead of String

2 years agoremoved unwrap
Jeroen Vannevel [Tue, 15 Feb 2022 14:58:06 +0000 (14:58 +0000)]
removed unwrap

2 years agocleaning
Jeroen Vannevel [Tue, 15 Feb 2022 14:55:21 +0000 (14:55 +0000)]
cleaning

2 years agofmt
Jeroen Vannevel [Tue, 15 Feb 2022 14:47:51 +0000 (14:47 +0000)]
fmt