]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoAuto merge of #13061 - ice1k:master, r=Veykril
bors [Fri, 19 Aug 2022 10:47:15 +0000 (10:47 +0000)]
Auto merge of #13061 - ice1k:master, r=Veykril

feat: Improved inline_call to replace `Self`

Fixes #13060

22 months agoAuto merge of #13064 - Veykril:rustfmt-err, r=Veykril
bors [Fri, 19 Aug 2022 07:23:01 +0000 (07:23 +0000)]
Auto merge of #13064 - Veykril:rustfmt-err, r=Veykril

Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209

22 months agoLog rustfmt parsing errors as warnings
Lukas Wirth [Fri, 19 Aug 2022 07:19:02 +0000 (09:19 +0200)]
Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209

22 months agoAuto merge of #13063 - Veykril:stop-flycheck, r=Veykril
bors [Fri, 19 Aug 2022 06:58:52 +0000 (06:58 +0000)]
Auto merge of #13063 - Veykril:stop-flycheck, r=Veykril

Implement lsp extension for cancelling running flychecks

Fixes https://github.com/rust-lang/rust-analyzer/issues/4828

22 months agoImplement lsp extension for cancelling running flychecks
Lukas Wirth [Fri, 19 Aug 2022 06:52:31 +0000 (08:52 +0200)]
Implement lsp extension for cancelling running flychecks

22 months agofix: use functional programming
ice1000 [Fri, 19 Aug 2022 01:08:59 +0000 (01:08 +0000)]
fix: use functional programming

22 months agofeat: Improved inline_call to replace `Self`
ice1000 [Fri, 19 Aug 2022 01:06:00 +0000 (01:06 +0000)]
feat: Improved inline_call to replace `Self`

22 months agoAuto merge of #13039 - davidbarsky:davidbarsky/remove-used-nightly-checking-code...
bors [Thu, 18 Aug 2022 16:06:18 +0000 (16:06 +0000)]
Auto merge of #13039 - davidbarsky:davidbarsky/remove-used-nightly-checking-code, r=Veykril

chore: remove unused `currentExtensionIsNightly()` in `config.ts`

I was debugging an unrelated issue in rust-analyzer, but came across this unused code and figured that it's fine to send a fully red PR :)

22 months agoAuto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril
bors [Thu, 18 Aug 2022 11:17:40 +0000 (11:17 +0000)]
Auto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril

fix: resolve path `Self` alone in value namespace

Fixes #12968

22 months agofix: resolve path `Self` alone in value namespace
Ryo Yoshida [Wed, 17 Aug 2022 23:46:06 +0000 (08:46 +0900)]
fix: resolve path `Self` alone in value namespace

22 months agoAuto merge of #13036 - sancho20021:10881-inline_type_alias_uses, r=Veykril
bors [Thu, 18 Aug 2022 08:02:37 +0000 (08:02 +0000)]
Auto merge of #13036 - sancho20021:10881-inline_type_alias_uses, r=Veykril

feat: Add an assist for inlining all type alias uses

## Description
`inline_type_alias_uses` assist tries to inline all selected type alias occurrences.

### Currently
Type alias used in `PathType` position are inlined.

### Not supported
- Removing type alias declaration if all uses are inlined.
- Removing redundant imports after inlining all uses in the file.
- Type alias not in `PathType` position, such as:
  - `A::new()`
  - `let x = A {}`
  - `let bits = A::BITS`
  - etc.

## Demonstration

![example](https://user-images.githubusercontent.com/45790125/184905226-9cb8ac81-1439-4387-a13b-e18ad4ecf208.gif)

## Related Issues
Partially fixes #10881

22 months agoAuto merge of #13045 - DorianListens:dscheidt/run-test-mod-outside, r=Veykril
bors [Thu, 18 Aug 2022 07:54:10 +0000 (07:54 +0000)]
Auto merge of #13045 - DorianListens:dscheidt/run-test-mod-outside, r=Veykril

feat: Run test mod from anywhere in parent file

The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589

22 months agoAuto merge of #12982 - jridgewell:into_future, r=Veykril
bors [Thu, 18 Aug 2022 07:37:47 +0000 (07:37 +0000)]
Auto merge of #12982 - jridgewell:into_future, r=Veykril

Implement IntoFuture type inference

One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.

`foo.await` itself [desugars](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/compiler/rustc_ast_lowering/src/expr.rs#L644-L658) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](https://github.com/rust-lang/rust/blob/e4417cf020fbcd6182c11637bc6b8694434bd81a/library/core/src/future/into_future.rs#L131-L139) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](https://github.com/rust-lang/rust/pull/98718).

22 months agoAuto merge of #13049 - lowr:fix/bare-dyn-assoc-type, r=Veykril
bors [Thu, 18 Aug 2022 07:29:16 +0000 (07:29 +0000)]
Auto merge of #13049 - lowr:fix/bare-dyn-assoc-type, r=Veykril

fix: resolve associated types of bare dyn types

Fixes #13031

We've been dropping the associated type bindings of trait object types that were written without the `dyn` keyword. This patch reuses the lowering logic for `TypeRef::DynTrait` so the associated type bindings are properly lowered.

22 months agofix: resolve associated types of bare dyn types
Ryo Yoshida [Wed, 17 Aug 2022 16:30:04 +0000 (01:30 +0900)]
fix: resolve associated types of bare dyn types

22 months agofeat: Run test mod from anywhere in parent file
Dorian Scheidt [Wed, 17 Aug 2022 16:57:14 +0000 (11:57 -0500)]
feat: Run test mod from anywhere in parent file

The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589

22 months agoAuto merge of #13044 - dzvon:fix-typo, r=Veykril
bors [Wed, 17 Aug 2022 14:59:02 +0000 (14:59 +0000)]
Auto merge of #13044 - dzvon:fix-typo, r=Veykril

fix: a bunch of typos

This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos

22 months agofix: a bunch of typos
Dezhi Wu [Wed, 17 Aug 2022 13:44:58 +0000 (21:44 +0800)]
fix: a bunch of typos

This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos

22 months agoAuto merge of #13034 - lowr:fix/regression-from-12993, r=lowr
bors [Wed, 17 Aug 2022 09:55:14 +0000 (09:55 +0000)]
Auto merge of #13034 - lowr:fix/regression-from-12993, r=lowr

fix: escape keywords used as names in earlier editions

Fixes #13030

There are keywords in Rust 2018+ that you can use as names without escaping when your crate is in Rust 2015 e.g. "try". We need to be consistent on how to keep track of the names regardless of how they are actually written in each crate. This patch attempts at it by taking such names into account and storing them uniformly in their escaped form.

22 months agofixup! feat: add inline_type_alias_uses assist
Aleksandr Pak [Wed, 17 Aug 2022 09:50:33 +0000 (12:50 +0300)]
fixup! feat: add inline_type_alias_uses assist

22 months agofix: escape keywords used as names in earlier editions
Ryo Yoshida [Tue, 16 Aug 2022 01:08:45 +0000 (10:08 +0900)]
fix: escape keywords used as names in earlier editions

22 months agoAuto merge of #13043 - Veykril:ide-db-trace, r=Veykril
bors [Wed, 17 Aug 2022 07:34:07 +0000 (07:34 +0000)]
Auto merge of #13043 - Veykril:ide-db-trace, r=Veykril

minor: Change tracing event level in apply_change

This is a rather spammy one, it shouldn't be `info`

22 months agominor: Change tracing event level in apply_change
Lukas Wirth [Wed, 17 Aug 2022 07:32:25 +0000 (09:32 +0200)]
minor: Change tracing event level in apply_change

22 months agoFind IntoFuture::IntoFuture's poll method
Justin Ridgewell [Tue, 16 Aug 2022 21:53:10 +0000 (17:53 -0400)]
Find IntoFuture::IntoFuture's poll method

22 months agochore: remove unused `currentExtensionIsNightly()` in config.ts
David Barsky [Tue, 16 Aug 2022 17:38:50 +0000 (13:38 -0400)]
chore: remove unused `currentExtensionIsNightly()` in config.ts

22 months agoAuto merge of #13038 - Veykril:rev-12947, r=Veykril
bors [Tue, 16 Aug 2022 17:13:44 +0000 (17:13 +0000)]
Auto merge of #13038 - Veykril:rev-12947, r=Veykril

Revert #12947, trigger workspace switches on all structure changes again

Closes https://github.com/rust-lang/rust-analyzer/issues/13029

22 months agoRevert #12947, trigger workspace switches on all structure changes again
Lukas Wirth [Tue, 16 Aug 2022 17:13:10 +0000 (19:13 +0200)]
Revert #12947, trigger workspace switches on all structure changes again

22 months agoAuto merge of #13037 - jonas-schievink:keyword-hover-setting, r=jonas-schievink
bors [Tue, 16 Aug 2022 16:18:50 +0000 (16:18 +0000)]
Auto merge of #13037 - jonas-schievink:keyword-hover-setting, r=jonas-schievink

feat: Add a setting for keyword hover popups

This adds `rust-analyzer.hover.documentation.keywords.enable`, which defaults to `true` and can be turned off to disable the keyword documentation hover popups, which can be somewhat distracting when triggered by accident, and offer relatively little value if you're already familiar with the language.

Fixes https://github.com/rust-lang/rust-analyzer/issues/12950

22 months agoAdd `.enable` suffix
Jonas Schievink [Tue, 16 Aug 2022 16:12:15 +0000 (18:12 +0200)]
Add `.enable` suffix

22 months agofixup! feat: add inline_type_alias_uses assist
Aleksandr Pak [Tue, 16 Aug 2022 15:29:22 +0000 (18:29 +0300)]
fixup! feat: add inline_type_alias_uses assist

22 months agoAdd a setting for keyword hover popups
Jonas Schievink [Tue, 16 Aug 2022 14:51:40 +0000 (16:51 +0200)]
Add a setting for keyword hover popups

22 months agofeat: add inline_type_alias_uses assist
Aleksandr Pak [Tue, 16 Aug 2022 14:06:32 +0000 (17:06 +0300)]
feat: add inline_type_alias_uses assist

22 months agoAuto merge of #13028 - yue4u:fix/literal-lookup, r=jonas-schievink
bors [Tue, 16 Aug 2022 13:28:00 +0000 (13:28 +0000)]
Auto merge of #13028 - yue4u:fix/literal-lookup, r=jonas-schievink

fix: record completion filtering

close #12975

22 months agofix: format literal lookup
yue4u [Mon, 15 Aug 2022 16:24:21 +0000 (01:24 +0900)]
fix: format literal lookup

22 months agoAuto merge of #13027 - jonas-schievink:fix-mismatch-with-trailing-empty-macro, r...
bors [Mon, 15 Aug 2022 16:06:59 +0000 (16:06 +0000)]
Auto merge of #13027 - jonas-schievink:fix-mismatch-with-trailing-empty-macro, r=jonas-schievink

fix: Fix incorrect type mismatch with `cfg_if!` and other macros in expression position

Fixes https://github.com/rust-lang/rust-analyzer/issues/12940

This is a bit of a hack, ideally `MacroStmts` would not exist at all after HIR lowering, but that requires changing how the lowering code works.

22 months agoFix lowering of empty macro expressions in trailing position
Jonas Schievink [Mon, 15 Aug 2022 15:44:52 +0000 (17:44 +0200)]
Fix lowering of empty macro expressions in trailing position

22 months agoAuto merge of #13026 - Veykril:nameres, r=Veykril
bors [Mon, 15 Aug 2022 14:49:12 +0000 (14:49 +0000)]
Auto merge of #13026 - Veykril:nameres, r=Veykril

internal: Make `resolve_name_in_module` a bit more lazy

22 months agoMake resolve_name_in_module a bit more lazy
Lukas Wirth [Mon, 15 Aug 2022 14:41:51 +0000 (16:41 +0200)]
Make resolve_name_in_module a bit more lazy

22 months agoAuto merge of #13025 - Veykril:simplify2, r=Veykril
bors [Mon, 15 Aug 2022 14:40:26 +0000 (14:40 +0000)]
Auto merge of #13025 - Veykril:simplify2, r=Veykril

Simplify

22 months agoSimplify
Lukas Wirth [Mon, 15 Aug 2022 14:16:59 +0000 (16:16 +0200)]
Simplify

22 months agoAuto merge of #13024 - jonas-schievink:hir-pretty, r=jonas-schievink
bors [Mon, 15 Aug 2022 12:08:35 +0000 (12:08 +0000)]
Auto merge of #13024 - jonas-schievink:hir-pretty, r=jonas-schievink

internal: Add an HIR pretty-printer

This improves the "View HIR" command by pretty-printing the HIR to make it much more readable.

Example function:

```rust
    fn newline(&mut self) {
        match self.buf.chars().rev().skip_while(|ch| *ch == ' ').next() {
            Some('\n') | None => {}
            _ => writeln!(self).unwrap(),
        }
    }
```

Previous output:

```
HIR expressions in the body of `newline`:
Idx::<Expr>(0): Path(Path { type_anchor: None, mod_path: ModPath { kind: Super(0), segments: [] }, generic_args: [] })
Idx::<Expr>(1): Field { expr: Idx::<Expr>(0), name: Name(Text("buf")) }
Idx::<Expr>(2): MethodCall { receiver: Idx::<Expr>(1), method_name: Name(Text("chars")), args: [], generic_args: None }
Idx::<Expr>(3): MethodCall { receiver: Idx::<Expr>(2), method_name: Name(Text("rev")), args: [], generic_args: None }
Idx::<Expr>(4): Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("ch"))] }, generic_args: [None] })
Idx::<Expr>(5): UnaryOp { expr: Idx::<Expr>(4), op: Deref }
Idx::<Expr>(6): Literal(Char(' '))
Idx::<Expr>(7): BinaryOp { lhs: Idx::<Expr>(5), rhs: Idx::<Expr>(6), op: Some(CmpOp(Eq { negated: false })) }
Idx::<Expr>(8): Closure { args: [Idx::<Pat>(1)], arg_types: [None], ret_type: None, body: Idx::<Expr>(7) }
Idx::<Expr>(9): MethodCall { receiver: Idx::<Expr>(3), method_name: Name(Text("skip_while")), args: [Idx::<Expr>(8)], generic_args: None }
Idx::<Expr>(10): MethodCall { receiver: Idx::<Expr>(9), method_name: Name(Text("next")), args: [], generic_args: None }
Idx::<Expr>(11): Literal(Char('\n'))
Idx::<Expr>(12): Block { id: BlockId(37), statements: [], tail: None, label: None }
Idx::<Expr>(13): Path(Path { type_anchor: None, mod_path: ModPath { kind: Super(0), segments: [] }, generic_args: [] })
Idx::<Expr>(14): Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("std")), Name(Text("fmt")), Name(Text("Arguments")), Name(Text("new_v1"))] }, generic_args: [None, None, None, None] })
Idx::<Expr>(15): Array(ElementList { elements: [], is_assignee_expr: false })
Idx::<Expr>(16): Ref { expr: Idx::<Expr>(15), rawness: Ref, mutability: Shared }
Idx::<Expr>(17): Array(ElementList { elements: [], is_assignee_expr: false })
Idx::<Expr>(18): Ref { expr: Idx::<Expr>(17), rawness: Ref, mutability: Shared }
Idx::<Expr>(19): Call { callee: Idx::<Expr>(14), args: [Idx::<Expr>(16), Idx::<Expr>(18)], is_assignee_expr: false }
Idx::<Expr>(20): MethodCall { receiver: Idx::<Expr>(13), method_name: Name(Text("write_fmt")), args: [Idx::<Expr>(19)], generic_args: None }
Idx::<Expr>(21): MacroStmts { statements: [], tail: Some(Idx::<Expr>(20)) }
Idx::<Expr>(22): MethodCall { receiver: Idx::<Expr>(21), method_name: Name(Text("unwrap")), args: [], generic_args: None }
Idx::<Expr>(23): Match { expr: Idx::<Expr>(10), arms: [MatchArm { pat: Idx::<Pat>(5), guard: None, expr: Idx::<Expr>(12) }, MatchArm { pat: Idx::<Pat>(6), guard: None, expr: Idx::<Expr>(22) }] }
Idx::<Expr>(24): Block { id: BlockId(36), statements: [], tail: Some(Idx::<Expr>(23)), label: None }
```

Output after this PR:

```rust
fn newline(…) {
    match self.buf.chars().rev().skip_while(
        |ch| (*ch) == (' '),
    ).next() {
        Some('\n') | None => {},
        _ => { // macro statements
            self.write_fmt(
                std::fmt::Arguments::new_v1(
                    &[],
                    &[],
                ),
            )
        }.unwrap(),
    }
}
```

It also works for consts and statics now.

This should make debugging HIR-lowering related issues like https://github.com/rust-lang/rust-analyzer/issues/12940 much easier.

22 months agoAdd an HIR pretty-printer
Jonas Schievink [Mon, 15 Aug 2022 11:51:45 +0000 (13:51 +0200)]
Add an HIR pretty-printer

22 months agoAuto merge of #13020 - lnicola:no-pre-release-flag, r=lnicola
bors [Sun, 14 Aug 2022 18:00:29 +0000 (18:00 +0000)]
Auto merge of #13020 - lnicola:no-pre-release-flag, r=lnicola

minor: Remove redundant --pre-release flag from publish

22 months agoRemove redundant --pre-release flag from publish
Laurențiu Nicola [Sun, 14 Aug 2022 17:52:43 +0000 (20:52 +0300)]
Remove redundant --pre-release flag from publish

22 months agoAuto merge of #13000 - shoffmeister:patch-1, r=lnicola
bors [Sun, 14 Aug 2022 17:51:38 +0000 (17:51 +0000)]
Auto merge of #13000 - shoffmeister:patch-1, r=lnicola

Take into account renamed extension id when launching

22 months agoAuto merge of #13017 - Veykril:vscode-diag-workaround, r=Veykril
bors [Sat, 13 Aug 2022 18:50:38 +0000 (18:50 +0000)]
Auto merge of #13017 - Veykril:vscode-diag-workaround, r=Veykril

Pad empty diagnostic messages in relatedInformation as well

Follw up to https://github.com/rust-lang/rust-analyzer/pull/13016

22 months agoPad empty diagnostic messages in relatedInformation as well
Lukas Wirth [Sat, 13 Aug 2022 18:49:00 +0000 (20:49 +0200)]
Pad empty diagnostic messages in relatedInformation as well

22 months agoAuto merge of #13016 - Veykril:vscode-diag-workaround, r=Veykril
bors [Sat, 13 Aug 2022 18:35:09 +0000 (18:35 +0000)]
Auto merge of #13016 - Veykril:vscode-diag-workaround, r=Veykril

Move VSCode diagnostics workaroudn into client code

22 months agoMove VSCode diagnostics workaroudn into client code
Lukas Wirth [Sat, 13 Aug 2022 18:18:21 +0000 (20:18 +0200)]
Move VSCode diagnostics workaroudn into client code

22 months agoAuto merge of #13014 - Veykril:simplify, r=Veykril
bors [Sat, 13 Aug 2022 18:03:56 +0000 (18:03 +0000)]
Auto merge of #13014 - Veykril:simplify, r=Veykril

minor: Simplify `GlobalState::handle_event`

22 months agoSimplify `GlobalState::handle_event`
Lukas Wirth [Sat, 13 Aug 2022 18:03:06 +0000 (20:03 +0200)]
Simplify `GlobalState::handle_event`

22 months agoAuto merge of #13010 - Veykril:build-script-probes, r=Veykril
bors [Sat, 13 Aug 2022 14:12:38 +0000 (14:12 +0000)]
Auto merge of #13010 - Veykril:build-script-probes, r=Veykril

Do not unconditionally succeed RUSTC_WRAPPER checks when run by build scripts

rust-analyzer's RUSTC_WRAPPER unconditionally succeeds `cargo check`
invocations tripping up build scripts using `cargo check` to probe for
successful compilations. To prevent this from happening the RUSTC_WRAPPER
now checks if it's run from a build script by looking for the
`CARGO_CFG_TARGET_ARCH` env var that cargo sets only when running build
scripts.

22 months agoDo not unconditionally succeed RUSTC_WRAPPER checks when run by build scripts
Lukas Wirth [Sat, 13 Aug 2022 10:13:48 +0000 (12:13 +0200)]
Do not unconditionally succeed RUSTC_WRAPPER checks when run by build scripts

rust-analyzer's RUSTC_WRAPPER unconditionally succeeds `cargo check`
invocations tripping up build scripts using `cargo check` to probe for
successful compilations. To prevent this from happening the RUSTC_WRAPPER
now checks if it's run from a build script by looking for the
`CARGO_CFG_TARGET_ARCH` env var that cargo sets only when running build
scripts.

22 months agoTake into account renamed extension id when launching
shoffmeister [Thu, 11 Aug 2022 11:36:41 +0000 (13:36 +0200)]
Take into account renamed extension id when launching

Signed-off-by: Stefan Hoffmeister <stefan.hoffmeister@econos.de>
22 months agoAuto merge of #13007 - lnicola:node-16, r=lnicola
bors [Fri, 12 Aug 2022 15:23:18 +0000 (15:23 +0000)]
Auto merge of #13007 - lnicola:node-16, r=lnicola

Use Node 16 on CI and upgrade lockfile version

Code is on 16 too, there's hopefully no need to keep using the old version.

22 months agoUpgrade npm lockfile
Laurențiu Nicola [Fri, 12 Aug 2022 15:22:14 +0000 (18:22 +0300)]
Upgrade npm lockfile

22 months agoUse Node 16 in CI workflows
Laurențiu Nicola [Fri, 12 Aug 2022 15:19:48 +0000 (18:19 +0300)]
Use Node 16 in CI workflows

22 months agoAuto merge of #12993 - lowr:patch/swap-name-and-escaped-name, r=Veykril
bors [Fri, 12 Aug 2022 14:53:45 +0000 (14:53 +0000)]
Auto merge of #12993 - lowr:patch/swap-name-and-escaped-name, r=Veykril

Make `Name` hold escaped name

Resolves #12787
Resolves rust-lang/rust#99361

This PR effectively swaps `Name` and `EscapedName` in hir. In other words, it makes `Name` hold and print escaped raw identifiers and introduces another struct `UnescapedName` for cases where you need to print names without "r#" prefix.

My rationale is that it makes it easier for us to format an escaped name into string, which is what we want when we serialize names in general. This is because we format a name into string usually when we are presenting it to the users and arguably they expect its escaped form as that's what they see and write in the source code.

I split the change for `Name` into 3 commits to make it easier to follow but it also made some tests fail in the intermediate commits. I can squash them into a commit after the review if desired. I've also made similar changes for `ModPath` and `EscapedModPath` as it makes them consistent with `Name`.

For reference, there was a brief discussion on this in [a zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/escaping.20.60Name.60s).

22 months agoAuto merge of #12997 - Veykril:no-such-field, r=Veykril
bors [Thu, 11 Aug 2022 08:42:04 +0000 (08:42 +0000)]
Auto merge of #12997 - Veykril:no-such-field, r=Veykril

fix: Fix panic in `no_such_field` when using tuple fields on record structs

22 months agoFix panic in no_such_field when using tuple fields on record structs
Lukas Wirth [Thu, 11 Aug 2022 08:41:30 +0000 (10:41 +0200)]
Fix panic in no_such_field when using tuple fields on record structs

22 months agoAdd test for runnables with raw identifiers
Ryo Yoshida [Sat, 30 Jul 2022 13:28:34 +0000 (22:28 +0900)]
Add test for runnables with raw identifiers

22 months agoMake `ModPath` display escaped path
Ryo Yoshida [Wed, 10 Aug 2022 17:17:15 +0000 (02:17 +0900)]
Make `ModPath` display escaped path

22 months agoMake tests pass
Ryo Yoshida [Mon, 1 Aug 2022 06:20:14 +0000 (15:20 +0900)]
Make tests pass

22 months agoRemove `EscapedName`
Ryo Yoshida [Mon, 1 Aug 2022 06:19:49 +0000 (15:19 +0900)]
Remove `EscapedName`

22 months agoAdd `UnescapedName` and make `Name` hold escaped name
Ryo Yoshida [Mon, 1 Aug 2022 05:20:05 +0000 (14:20 +0900)]
Add `UnescapedName` and make `Name` hold escaped name

22 months agoAuto merge of #12989 - lnicola:rm-1-64-abi, r=Veykril
bors [Wed, 10 Aug 2022 14:53:21 +0000 (14:53 +0000)]
Auto merge of #12989 - lnicola:rm-1-64-abi, r=Veykril

internal: Remove incomplete 1.64 ABI

This no longer works for current nightlies and should not be needed any more, since we can use the toolchain's proc macro server instead.

22 months agoAuto merge of #12984 - Veykril:keep-going, r=Veykril
bors [Wed, 10 Aug 2022 14:43:23 +0000 (14:43 +0000)]
Auto merge of #12984 - Veykril:keep-going, r=Veykril

Use `--keep-going` cargo flag when building build scripts

See https://github.com/rust-lang/rust-analyzer/issues/12973#issuecomment-1209159426

22 months agoAuto merge of #12992 - lowr:fix/type-inference-for-byte-string-pat, r=Veykril
bors [Wed, 10 Aug 2022 11:05:02 +0000 (11:05 +0000)]
Auto merge of #12992 - lowr:fix/type-inference-for-byte-string-pat, r=Veykril

fix: infer byte string pattern as `&[u8]` when matched against slices

Fixes #12630

c.f. [rustc_typeck](https://github.com/rust-lang/rust/blob/1603a70f82240ba2d27f72f964e36614d7620ad3/compiler/rustc_typeck/src/check/pat.rs#L388-L404)

22 months agofix: infer byte string pattern as `&[u8]` when matched against slices
Ryo Yoshida [Wed, 10 Aug 2022 10:17:13 +0000 (19:17 +0900)]
fix: infer byte string pattern as `&[u8]` when matched against slices

22 months agoAuto merge of #12990 - edwin0cheng:improve-ws, r=Veykril
bors [Wed, 10 Aug 2022 09:29:19 +0000 (09:29 +0000)]
Auto merge of #12990 - edwin0cheng:improve-ws, r=Veykril

fix: Improve whitespace insertion in mbe

Related:  https://github.com/rust-lang/rust-analyzer/issues/12260#issuecomment-1126957162

22 months agoFixes tests
Edwin Cheng [Wed, 10 Aug 2022 08:29:23 +0000 (16:29 +0800)]
Fixes tests

22 months agoImprove insert whitespace in mbe
Edwin Cheng [Wed, 10 Aug 2022 08:28:56 +0000 (16:28 +0800)]
Improve insert whitespace in mbe

22 months agoRe-try build script building with --keep-going
Lukas Wirth [Wed, 10 Aug 2022 08:23:46 +0000 (10:23 +0200)]
Re-try build script building with --keep-going

22 months agoRemove incomplete 1.64 ABI
Laurențiu Nicola [Wed, 10 Aug 2022 07:49:49 +0000 (10:49 +0300)]
Remove incomplete 1.64 ABI

22 months agoAuto merge of #12987 - Veykril:ellipsis-recov, r=Veykril
bors [Tue, 9 Aug 2022 21:03:04 +0000 (21:03 +0000)]
Auto merge of #12987 - Veykril:ellipsis-recov, r=Veykril

Recover from missing ellipsis in record literals for path expressions

22 months agoSuggest `.await` when type impls IntoFuture
Justin Ridgewell [Tue, 9 Aug 2022 20:25:25 +0000 (16:25 -0400)]
Suggest `.await` when type impls IntoFuture

22 months agoAuto merge of #12986 - Veykril:completions, r=Veykril
bors [Tue, 9 Aug 2022 16:23:54 +0000 (16:23 +0000)]
Auto merge of #12986 - Veykril:completions, r=Veykril

Fix pattern field completions not working for unions

22 months agoRecover from missing ellipsis in record literals for path expressions
Lukas Wirth [Tue, 9 Aug 2022 16:23:25 +0000 (18:23 +0200)]
Recover from missing ellipsis in record literals for path expressions

22 months agoAdd some more `cov_mark`s
Lukas Wirth [Tue, 9 Aug 2022 16:08:05 +0000 (18:08 +0200)]
Add some more `cov_mark`s

22 months agoFix pattern field completions not working for unions
Lukas Wirth [Tue, 9 Aug 2022 15:53:16 +0000 (17:53 +0200)]
Fix pattern field completions not working for unions

22 months agoUse `--keep-going` cargo flag when building build scripts
Lukas Wirth [Tue, 9 Aug 2022 12:31:17 +0000 (14:31 +0200)]
Use `--keep-going` cargo flag when building build scripts

22 months agoAuto merge of #12981 - kadiwa4:remove_some_imports, r=Veykril
bors [Tue, 9 Aug 2022 07:03:35 +0000 (07:03 +0000)]
Auto merge of #12981 - kadiwa4:remove_some_imports, r=Veykril

Remove imports that are also in edition 2021's prelude

small cleanup

22 months agoImplement IntoFuture type inference
Justin Ridgewell [Tue, 9 Aug 2022 00:20:45 +0000 (20:20 -0400)]
Implement IntoFuture type inference

22 months agoremove imports that are also in edition 2021's prelude
KaDiWa [Mon, 8 Aug 2022 23:16:32 +0000 (01:16 +0200)]
remove imports that are also in edition 2021's prelude

22 months agoAuto merge of #12974 - fprasx:master, r=lnicola
bors [Mon, 8 Aug 2022 15:13:20 +0000 (15:13 +0000)]
Auto merge of #12974 - fprasx:master, r=lnicola

Corrected order of printing op and `=`

Fixes https://github.com/rust-lang/rust-analyzer/issues/12971 where `Display` impl for assignment operators does `=+` instead of `+=`

22 months agoCorrected order of printing op and `=`
fprasx [Mon, 8 Aug 2022 15:05:18 +0000 (11:05 -0400)]
Corrected order of printing op and `=`

22 months agoAuto merge of #12962 - lowr:patch/parse-last-range-pattern, r=Veykril
bors [Mon, 8 Aug 2022 15:03:39 +0000 (15:03 +0000)]
Auto merge of #12962 - lowr:patch/parse-last-range-pattern, r=Veykril

Parse range patterns in struct and slice without trailing comma

Resolves #12935

This patch includes the support for range patterns in slices, which is unstable (tracked in https://github.com/rust-lang/rust/issues/67264). If it's not desired I can remove it.

22 months agoParse range patterns in let statement with type annotation
Ryo Yoshida [Mon, 8 Aug 2022 15:00:22 +0000 (00:00 +0900)]
Parse range patterns in let statement with type annotation

22 months agoAuto merge of #12967 - jhgg:code/fix-toggle-hints, r=Veykril
bors [Mon, 8 Aug 2022 12:05:07 +0000 (12:05 +0000)]
Auto merge of #12967 - jhgg:code/fix-toggle-hints, r=Veykril

[code] make toggleInlayHints understand {off,on}UntilPressed

fixes #12964

22 months agoAuto merge of #12951 - jonas-schievink:doc-cli-stability, r=Veykril
bors [Mon, 8 Aug 2022 11:56:44 +0000 (11:56 +0000)]
Auto merge of #12951 - jonas-schievink:doc-cli-stability, r=Veykril

internal: Document CLI flag stability

22 months agoAuto merge of #12905 - HKalbasi:master, r=Veykril
bors [Mon, 8 Aug 2022 11:46:22 +0000 (11:46 +0000)]
Auto merge of #12905 - HKalbasi:master, r=Veykril

Generate rust type from json

fix #10118

Should this be a diagnostic? I made it a diagnostic because of issue label.

22 months agoAuto merge of #12937 - fprasx:master, r=Veykril
bors [Mon, 8 Aug 2022 11:37:51 +0000 (11:37 +0000)]
Auto merge of #12937 - fprasx:master, r=Veykril

Add fixups for incomplete in proc-macros

Partially implements https://github.com/rust-lang/rust-analyzer/issues/12777.

Added support for for loops and match statements.

I couldn't do paths like `crate::foo::` as I wasn't able to add `SyntheticTokens` to the end of `foo::`, they always ended up after `crate::`

This is my first contribution so please don't be shy about letting me know if I've done anything wrong!

22 months agoAuto merge of #12942 - lowr:fix/concat-with-char, r=Veykril
bors [Mon, 8 Aug 2022 11:28:42 +0000 (11:28 +0000)]
Auto merge of #12942 - lowr:fix/concat-with-char, r=Veykril

fix: make `concat!` work with char

Fixes #12921

- I avoided making `unquote_str()` take char literals as well because it's depended on by another function `parse_string()` that's only supposed to take strings.
- Even with this patch, we don't output `\0` as `\u{0}` which #12921 pointed out ~~, but we're not actually responsible for serializing it but rowan is~~. They are functionally equivalent and I don't think it'd cause any confusion, but we *could* try escaping them before serialization (for reference, `rustc -Zunpretty=expanded`, which `cargo expand` uses under the hood, [makes use of `str::escape_default()`](https://github.com/rust-lang/rust/blob/3830ecaa8db798d2727cbdfa4ddf314ff938f268/compiler/rustc_ast/src/util/literal.rs#L161).

22 months ago[code] make toggleInlayHints understand {off,on}UntilPressed
Jake Heinz [Mon, 8 Aug 2022 00:20:17 +0000 (00:20 +0000)]
[code] make toggleInlayHints understand {off,on}UntilPressed

22 months agoAuto merge of #12956 - oxalica:feat/la-arena-apis, r=lnicola
bors [Sun, 7 Aug 2022 08:50:23 +0000 (08:50 +0000)]
Auto merge of #12956 - oxalica:feat/la-arena-apis, r=lnicola

More methods and traits for `la_arena::ArenaMap`

Continue of #12931. Seems that I forgot some methods in the previous PR :(

I also changed `ArenaMap::insert` to return the old value, to match the map-like collection API of std. **So this is a breaking change.**

r? `@lnicola`

22 months agoParse range patterns in struct and slice without trailing comma
Ryo Yoshida [Fri, 5 Aug 2022 11:01:50 +0000 (20:01 +0900)]
Parse range patterns in struct and slice without trailing comma

22 months agoAuto merge of #12959 - lnicola:rainbows-again, r=lnicola
bors [Sun, 7 Aug 2022 06:30:11 +0000 (06:30 +0000)]
Auto merge of #12959 - lnicola:rainbows-again, r=lnicola

Fix `test_rainbow_highlighting` gate

CC https://github.com/rust-lang/rust-analyzer/pull/12903#pullrequestreview-1058906953

22 months agoFix test_rainbow_highlighting gate
Laurențiu Nicola [Sun, 7 Aug 2022 06:29:26 +0000 (09:29 +0300)]
Fix test_rainbow_highlighting gate

22 months agoReturns the old value for la_arena::ArenaMap::insert
oxalica [Sat, 6 Aug 2022 20:48:52 +0000 (04:48 +0800)]
Returns the old value for la_arena::ArenaMap::insert

22 months agoImpl more methods and traits for la_arena::ArenaMap
oxalica [Sat, 6 Aug 2022 20:17:04 +0000 (04:17 +0800)]
Impl more methods and traits for la_arena::ArenaMap