]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoon hover fallback error, adds ast::type as possible node
Jean santos [Wed, 3 Aug 2022 20:37:11 +0000 (17:37 -0300)]
on hover fallback error, adds ast::type as possible node

22 months agoAuto merge of #12934 - Veykril:typing, r=Veykril
bors [Wed, 3 Aug 2022 16:23:49 +0000 (16:23 +0000)]
Auto merge of #12934 - Veykril:typing, r=Veykril

Add a setting to disable comment continuation in VSCode

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

22 months agoAdd a setting to disable comment continuation in VSCode
Lukas Wirth [Wed, 3 Aug 2022 16:22:45 +0000 (18:22 +0200)]
Add a setting to disable comment continuation in VSCode

22 months agoAuto merge of #12933 - Veykril:proc-ignored, r=Veykril
bors [Wed, 3 Aug 2022 16:11:08 +0000 (16:11 +0000)]
Auto merge of #12933 - Veykril:proc-ignored, r=Veykril

Use an empty expander for ignored non-attribute proc-macros

Identity is the wrong behaviour for anything that's not an attribute here

22 months agoUse an empty expander for ignored non-attribute proc-macros
Lukas Wirth [Wed, 3 Aug 2022 16:10:15 +0000 (18:10 +0200)]
Use an empty expander for ignored non-attribute proc-macros

22 months agoAuto merge of #12930 - lnicola:subtree-branch, r=lnicola
bors [Wed, 3 Aug 2022 06:49:13 +0000 (06:49 +0000)]
Auto merge of #12930 - lnicola:subtree-branch, r=lnicola

minor: Use the release branch in xtask promote

22 months agoUse the release branch in xtask promote
Laurențiu Nicola [Wed, 3 Aug 2022 06:48:44 +0000 (09:48 +0300)]
Use the release branch in xtask promote

22 months agoAuto merge of #12837 - DorianListens:dscheidt/generate-enum-data, r=Veykril
bors [Tue, 2 Aug 2022 19:50:01 +0000 (19:50 +0000)]
Auto merge of #12837 - DorianListens:dscheidt/generate-enum-data, r=Veykril

feat: support associated values in "Generate Enum Variant" assist

This change adds support for associated values to the "Generate Enum Variant" assist.

I've split the implementation out into 4 steps to make code review easier:
- Add "add_variant" support to the structural ast editing system in `edit_in_place`
- Migrate `generate_enum_variant` to use structural ast editing instead of string manipulation
- Support tuple fields
- Support record fields

Please let me know if I should leave the commits as-is, or squash before merging.

Fixes #12797

22 months agoSupport PathPat paths in generate_enum_variant
Dorian Scheidt [Tue, 2 Aug 2022 16:11:32 +0000 (12:11 -0400)]
Support PathPat paths in generate_enum_variant

22 months agoBe more strict about supported Paths in generate_enum_variant
Dorian Scheidt [Tue, 2 Aug 2022 15:54:00 +0000 (11:54 -0400)]
Be more strict about supported Paths in generate_enum_variant

PathType path parents don't support this assist

22 months agoSupport record fields in generate_enum_variant
Dorian Scheidt [Wed, 20 Jul 2022 18:02:21 +0000 (13:02 -0500)]
Support record fields in generate_enum_variant

22 months agoSupport tuple fields in generate_enum_variant
Dorian Scheidt [Wed, 20 Jul 2022 17:26:27 +0000 (12:26 -0500)]
Support tuple fields in generate_enum_variant

22 months agoconvert generate_enum_variant to use add_variant
Dorian Scheidt [Wed, 20 Jul 2022 17:11:00 +0000 (12:11 -0500)]
convert generate_enum_variant to use add_variant

22 months agoSupport adding variants via structural editing
Dorian Scheidt [Wed, 20 Jul 2022 17:03:18 +0000 (12:03 -0500)]
Support adding variants via structural editing

22 months agoAuto merge of #12880 - palango:while-fixup, r=Veykril
bors [Tue, 2 Aug 2022 14:08:56 +0000 (14:08 +0000)]
Auto merge of #12880 - palango:while-fixup, r=Veykril

Add syntax fixup for while loops

Part of https://github.com/rust-lang/rust-analyzer/issues/12777

This is a first iteration to gather some feedback. In particular I'm not sure if the curly braces should be added here, but I couldn't get the test to work without them. Any hints welcome!

22 months agoAuto merge of #12919 - jonas-schievink:speling, r=jonas-schievink
bors [Tue, 2 Aug 2022 13:10:12 +0000 (13:10 +0000)]
Auto merge of #12919 - jonas-schievink:speling, r=jonas-schievink

fix: Fix r-a spelling in some places

User-facing change: All commands are now rendered as "rust-analyzer: Command" rather than "Rust Analyzer: Command".

Alternative to https://github.com/rust-lang/rust-analyzer/pull/12910

Potentially controversial, since other extensions don't do this, so I won't self-approve.

22 months agoAuto merge of #12920 - jonas-schievink:arm-release, r=jonas-schievink
bors [Mon, 1 Aug 2022 14:17:53 +0000 (14:17 +0000)]
Auto merge of #12920 - jonas-schievink:arm-release, r=jonas-schievink

feat: Publish extension for 32-bit ARM systems

22 months agoDon't run on PRs
Jonas Schievink [Mon, 1 Aug 2022 14:16:22 +0000 (16:16 +0200)]
Don't run on PRs

22 months agoUpload arm-unknown-linux-gnueabihf build artifact
Laurențiu Nicola [Mon, 1 Aug 2022 13:54:54 +0000 (16:54 +0300)]
Upload arm-unknown-linux-gnueabihf build artifact

22 months agoFix linker env var name
Laurențiu Nicola [Mon, 1 Aug 2022 13:46:18 +0000 (16:46 +0300)]
Fix linker env var name

22 months agoFix target check
Jonas Schievink [Mon, 1 Aug 2022 13:22:02 +0000 (15:22 +0200)]
Fix target check

22 months agoSet linker
Jonas Schievink [Mon, 1 Aug 2022 13:09:45 +0000 (15:09 +0200)]
Set linker

22 months agoPublish extension for 32-bit ARM systems
Jonas Schievink [Mon, 1 Aug 2022 12:26:20 +0000 (14:26 +0200)]
Publish extension for 32-bit ARM systems

22 months agoFix r-a spelling in some places
Jonas Schievink [Mon, 1 Aug 2022 11:47:09 +0000 (13:47 +0200)]
Fix r-a spelling in some places

22 months agoAuto merge of #12918 - lowr:fix/doctest-names, r=Veykril
bors [Mon, 1 Aug 2022 10:12:59 +0000 (10:12 +0000)]
Auto merge of #12918 - lowr:fix/doctest-names, r=Veykril

fix: remove whitespaces from doctest names

When rustdoc runs doctests, it removes whitespaces from the tests' path ([code](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/doctest.rs#L951)). See https://github.com/rust-lang/rust/pull/89422 for details.

Interestingly enough, "Run doctest" has been working without much problem even though rust-analyzer hasn't followed the change. This is because cargo passes the test name to rustdoc via `--test-args` option, and then rustdoc [splits it by whitespace](https://github.com/rust-lang/rust/blob/25bb1c13bd472b75ceebee3b8dcf4dcbc431a8be/src/librustdoc/config.rs#L513-L514); the last element of the split test name **always** matches the test name that rustdoc generates.

However, it may run other tests unexpectedly (to be precise, this has long since been a thing because of the split). Consider the following example:

```rust
struct A<T, U>(T, U);
struct B<T, U>(T, U);
/// ```
/// doctest here
/// ```
impl<T, U> A<T, U> {}
/// ```
/// doctest here
/// ```
impl<T, U> B<T, U> {}
```

When you "Run doctest" either of the two, rustdoc considers "U>" one of the test specs and both doctests are run. This patch fixes it by following rustdoc and removing the whitespace from the doctests' name.

22 months agofix: remove whitespaces from doctest names
Ryo Yoshida [Mon, 1 Aug 2022 07:48:33 +0000 (16:48 +0900)]
fix: remove whitespaces from doctest names

23 months agoAuto merge of #12915 - lnicola:promote-subtree, r=lnicola
bors [Sun, 31 Jul 2022 17:58:40 +0000 (17:58 +0000)]
Auto merge of #12915 - lnicola:promote-subtree, r=lnicola

internal: Update `xtask promote` and release instructions

Update `xtask` for the subtree workflow. This doesn't explain how to do a `rust -> RA`  sync, since that's definitely more involved, but will probably only happen rarely.

23 months agoAuto merge of #12916 - Veykril:nits, r=Veykril
bors [Sun, 31 Jul 2022 17:42:10 +0000 (17:42 +0000)]
Auto merge of #12916 - Veykril:nits, r=Veykril

minor: Properly cfg the `max` field of Limit

23 months agoGive variables more descriptive names
Lukas Wirth [Sun, 31 Jul 2022 17:27:34 +0000 (19:27 +0200)]
Give variables more descriptive names

23 months agoProperly cfg the `max` field of Limit
Lukas Wirth [Sun, 31 Jul 2022 17:27:20 +0000 (19:27 +0200)]
Properly cfg the `max` field of Limit

23 months agoUpdate xtask promote and release instructions
Laurențiu Nicola [Sun, 31 Jul 2022 17:26:35 +0000 (20:26 +0300)]
Update xtask promote and release instructions

23 months agoAuto merge of #12913 - Veykril:attr-merge, r=Veykril
bors [Sat, 30 Jul 2022 07:53:48 +0000 (07:53 +0000)]
Auto merge of #12913 - Veykril:attr-merge, r=Veykril

fix: Fix ast-id up when merging raw attributes

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

23 months agofix: Fix ast-id up when merging raw attributes
Lukas Wirth [Sat, 30 Jul 2022 07:43:30 +0000 (09:43 +0200)]
fix: Fix ast-id up when merging raw attributes

23 months agoAuto merge of #12906 - cynecx:fix-completions, r=Veykril
bors [Fri, 29 Jul 2022 15:41:36 +0000 (15:41 +0000)]
Auto merge of #12906 - cynecx:fix-completions, r=Veykril

fix: complete path of existing record expr

23 months agofix: complete path of existing record expr
cynecx [Fri, 29 Jul 2022 00:27:16 +0000 (02:27 +0200)]
fix: complete path of existing record expr

23 months agoAuto merge of #12904 - lnicola:completion-builtin-filter, r=lnicola
bors [Thu, 28 Jul 2022 18:52:00 +0000 (18:52 +0000)]
Auto merge of #12904 - lnicola:completion-builtin-filter, r=lnicola

internal: Be more explicit when filtering built-in completions

We return every built-in type here, but only have `u32` in the tests, so let's look for that one to make tests more reliable across platforms.

23 months agoBe more explicit when filtering built-in completions
Laurențiu Nicola [Thu, 28 Jul 2022 18:45:47 +0000 (21:45 +0300)]
Be more explicit when filtering built-in completions

23 months agoAuto merge of #12903 - lnicola:rainbows, r=Veykril
bors [Thu, 28 Jul 2022 18:08:09 +0000 (18:08 +0000)]
Auto merge of #12903 - lnicola:rainbows, r=Veykril

Only run rainbow highlighting test on 64-bit Unix

23 months agoOnly run rainbow highlighting test on 64-bit Unix
Laurențiu Nicola [Thu, 28 Jul 2022 18:02:36 +0000 (21:02 +0300)]
Only run rainbow highlighting test on 64-bit Unix

23 months agoAuto merge of #12902 - Veykril:item-scope, r=Veykril
bors [Thu, 28 Jul 2022 17:38:59 +0000 (17:38 +0000)]
Auto merge of #12902 - Veykril:item-scope, r=Veykril

fix: Order ItemScope::entries results

23 months agofix: Order ItemScope::entries results
Lukas Wirth [Thu, 28 Jul 2022 16:49:31 +0000 (18:49 +0200)]
fix: Order ItemScope::entries results

23 months agoAuto merge of #12901 - Veykril:completion-trait-expr, r=Veykril
bors [Thu, 28 Jul 2022 15:51:30 +0000 (15:51 +0000)]
Auto merge of #12901 - Veykril:completion-trait-expr, r=Veykril

fix: Don't complete marker traits in expression position

cc https://github.com/rust-lang/rust-analyzer/issues/12196

23 months agofix: Don't complete marker traits in expression position
Lukas Wirth [Thu, 28 Jul 2022 15:49:23 +0000 (17:49 +0200)]
fix: Don't complete marker traits in expression position

23 months agoAuto merge of #12900 - pksunkara:master, r=lnicola
bors [Thu, 28 Jul 2022 15:25:07 +0000 (15:25 +0000)]
Auto merge of #12900 - pksunkara:master, r=lnicola

publish: Use cargo ws rename to rename crates

Follow up for #12716

23 months agopublish: Use cargo ws rename to rename crates
Pavan Kumar Sunkara [Thu, 28 Jul 2022 15:21:14 +0000 (16:21 +0100)]
publish: Use cargo ws rename to rename crates

23 months agoAuto merge of #12899 - Veykril:compl-qualifier, r=Veykril
bors [Thu, 28 Jul 2022 15:11:24 +0000 (15:11 +0000)]
Auto merge of #12899 - Veykril:compl-qualifier, r=Veykril

fix: Do completions in path qualifier position

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

Not too happy with the duplication needed for this, but it is what it is. Completions in path qualifiers will have to be filtered properly still, but its better to show too many completions for this than too few for now.

23 months agofix: Do completions in path qualifier position
Lukas Wirth [Thu, 28 Jul 2022 15:09:31 +0000 (17:09 +0200)]
fix: Do completions in path qualifier position

23 months agoAuto merge of #12898 - Veykril:compl-pat-brace, r=Veykril
bors [Thu, 28 Jul 2022 13:48:12 +0000 (13:48 +0000)]
Auto merge of #12898 - Veykril:compl-pat-brace, r=Veykril

fix: Fix pattern completions adding unnecessary braces

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

23 months agofix: Fix pattern completions adding unnecessary braces
Lukas Wirth [Thu, 28 Jul 2022 13:47:46 +0000 (15:47 +0200)]
fix: Fix pattern completions adding unnecessary braces

23 months agoAuto merge of #12895 - Veykril:compl-anchor, r=Veykril
bors [Thu, 28 Jul 2022 08:06:58 +0000 (08:06 +0000)]
Auto merge of #12895 - Veykril:compl-anchor, r=Veykril

fix: Calculate completions after type anchors

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

23 months agofix: Calculate completions after type anchors
Lukas Wirth [Thu, 28 Jul 2022 08:05:21 +0000 (10:05 +0200)]
fix: Calculate completions after type anchors

23 months agoAuto merge of #12891 - brennanvincent:expander_stack, r=lnicola
bors [Wed, 27 Jul 2022 19:40:59 +0000 (19:40 +0000)]
Auto merge of #12891 - brennanvincent:expander_stack, r=lnicola

Use large stack on expander thread

I have verified that this fixes #12884 for me.

Hat tip to `@bjorn3` for identifying the cause of the issue.

23 months agoUse large stack on expander thread
Brennan Vincent [Wed, 27 Jul 2022 18:34:46 +0000 (14:34 -0400)]
Use large stack on expander thread

23 months agoAdd syntax fixup for `loop`
Paul Lange [Wed, 27 Jul 2022 16:18:51 +0000 (18:18 +0200)]
Add syntax fixup for `loop`

23 months agoAdd syntax fixup for while loops
Paul Lange [Tue, 26 Jul 2022 14:10:26 +0000 (16:10 +0200)]
Add syntax fixup for while loops

23 months agoAuto merge of #12890 - Veykril:syntax-blocks, r=Veykril
bors [Wed, 27 Jul 2022 15:30:03 +0000 (15:30 +0000)]
Auto merge of #12890 - Veykril:syntax-blocks, r=Veykril

internal: Assume condition/iterable is missing if there is only a BlockExpr

cc https://github.com/rust-lang/rust-analyzer/pull/12880#issuecomment-1195567103

It sounds good on paper, so let's try it

23 months agointernal: Assume condition/iterable is missing if there is only a BlockExpr
Lukas Wirth [Wed, 27 Jul 2022 15:14:50 +0000 (17:14 +0200)]
internal: Assume condition/iterable is missing if there is only a BlockExpr

23 months agoAuto merge of #12830 - hi-rustin:rustin-patch-issue-12717-fix, r=Veykril
bors [Wed, 27 Jul 2022 12:31:26 +0000 (12:31 +0000)]
Auto merge of #12830 - hi-rustin:rustin-patch-issue-12717-fix, r=Veykril

Find original ast node before compute ref match

ref https://github.com/rust-lang/rust-analyzer/issues/12717

23 months agoFind original ast node before compute ref match in fn render
hi-rustin [Wed, 27 Jul 2022 12:18:00 +0000 (20:18 +0800)]
Find original ast node before compute ref match in fn render

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
23 months agoAuto merge of #12887 - Veykril:compl-pref-fix, r=Veykril
bors [Wed, 27 Jul 2022 11:48:55 +0000 (11:48 +0000)]
Auto merge of #12887 - Veykril:compl-pref-fix, r=Veykril

fix: Honor ref expressions for compute_ref_match completions

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

23 months agofix: Honor ref expressions for compute_ref_match completions
Lukas Wirth [Wed, 27 Jul 2022 11:48:26 +0000 (13:48 +0200)]
fix: Honor ref expressions for compute_ref_match completions

23 months agoAuto merge of #12886 - Veykril:sema-cache, r=Veykril
bors [Wed, 27 Jul 2022 10:46:20 +0000 (10:46 +0000)]
Auto merge of #12886 - Veykril:sema-cache, r=Veykril

fix: Fix Semantics::original_ast_node not caching the resulting file

23 months agofix: Fix Semantics::original_ast_node not caching the resulting file
Lukas Wirth [Wed, 27 Jul 2022 10:45:29 +0000 (12:45 +0200)]
fix: Fix Semantics::original_ast_node not caching the resulting file

23 months agoAuto merge of #12877 - zachs18:inline-def-in-macro, r=zachs18
bors [Tue, 26 Jul 2022 16:14:51 +0000 (16:14 +0000)]
Auto merge of #12877 - zachs18:inline-def-in-macro, r=zachs18

fix: Insert spaces when inlining a function defined in a macro.

(partially) fixes #12860.

This PR (only) addresses the whitespace issue when inlining functions defined in macros.

Additionally, the indentation/spacing is not ideal, but works, e.g.
```rs
macro_rules! define_function {
    () => { fn test_function_macro() {
        if let Some(3) = 3i32.checked_add(0) {
            println!("3 + 0 == 3");
        }
    } };
}
define_function!();
fn main() {
    test_function_macro();
}
// previously became
// ...
fn main() {
    ifletSome(3)=3i32.checked_add(0){println!("3 + 0 == 3");};
}
// now becomes
// ...
fn main() {
    if let Some(3) = 3i32.checked_add(0){
        println!("3 + 0 == 3");

      };
}
```

The `self` -> `this` problem[^this] is (probably?) a separate problem that I am also looking into.

[^this]: As mentioned in [my comment on the above issue](https://github.com/rust-lang/rust-analyzer/issues/12860#issuecomment-1193231766), inlining a method defined in a macro does not properly replace `self` with the new local `this`.

23 months agoRemove FIXME comment for unreachable fallback.
Zachary S [Tue, 26 Jul 2022 15:59:19 +0000 (10:59 -0500)]
Remove FIXME comment for unreachable fallback.

23 months agoAuto merge of #12881 - Veykril:proc-srv, r=Veykril
bors [Tue, 26 Jul 2022 14:31:26 +0000 (14:31 +0000)]
Auto merge of #12881 - Veykril:proc-srv, r=Veykril

fix: Fix server panicking on project loading when proc-macros are disabled

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

23 months agofix: Fix server panicking on project loading when proc-macros are disabled
Lukas Wirth [Tue, 26 Jul 2022 14:30:45 +0000 (16:30 +0200)]
fix: Fix server panicking on project loading when proc-macros are disabled

23 months agoAuto merge of #12878 - fasterthanlime:standalone-pms-exe, r=lnicola
bors [Tue, 26 Jul 2022 10:33:43 +0000 (10:33 +0000)]
Auto merge of #12878 - fasterthanlime:standalone-pms-exe, r=lnicola

Find standalone proc-macro-srv on windows too

I forgot that executables end with `.exe` on Windows in:

  * https://github.com/rust-lang/rust-analyzer/pull/12858

23 months agoFind standalone proc-macro-srv on windows too
Amos Wenger [Tue, 26 Jul 2022 09:30:41 +0000 (11:30 +0200)]
Find standalone proc-macro-srv on windows too

23 months agoAuto merge of #12864 - Veykril:derive-helpers, r=Veykril
bors [Tue, 26 Jul 2022 07:34:11 +0000 (07:34 +0000)]
Auto merge of #12864 - Veykril:derive-helpers, r=Veykril

feat: Resolve derive helper attributes in IDE layer

![image](https://user-images.githubusercontent.com/3757771/180647125-98cae13b-a7b4-446b-8a64-fae014f982e2.png)

Also downmaps tokens inside deriver helpers to the derive expansion
![image](https://user-images.githubusercontent.com/3757771/180642110-699bdc73-e1f3-4692-94f2-21544f824ab9.png)

This does not handle the case where multiple derives make use of the same helper name though, unsure how to tackle that yet.

Partially addresses https://github.com/rust-lang/rust-analyzer/issues/10935

23 months agoAllow name querying for derive helpers
Lukas Wirth [Sun, 24 Jul 2022 12:32:39 +0000 (14:32 +0200)]
Allow name querying for derive helpers

23 months agoRecord derive helper attributes, resolve them in IDE layer
Lukas Wirth [Sun, 24 Jul 2022 12:05:37 +0000 (14:05 +0200)]
Record derive helper attributes, resolve them in IDE layer

23 months agofeat: Downmap tokens inside derive helpers
Lukas Wirth [Sun, 24 Jul 2022 10:04:15 +0000 (12:04 +0200)]
feat: Downmap tokens inside derive helpers

23 months agoAuto merge of #12858 - fasterthanlime:proc-macro-srv-bin, r=Veykril
bors [Tue, 26 Jul 2022 06:35:16 +0000 (06:35 +0000)]
Auto merge of #12858 - fasterthanlime:proc-macro-srv-bin, r=Veykril

Add `rust-analyzer-proc-macro-srv` binary, use it if found in sysroot

This adds a `bin` crate which simply runs `proc_macro_srv::cli::run()` (it does no CLI argument parsing, nothing).

The intent is to build that crate in Rust CI as part of the `dist::Rustc` component, then ship it in the sysroot: it would probably land in something like `~/.rustup/toolchains/nightly-2022-07-23-x86_64-unknown-linux-gnu/libexec/proc-macro-srv-cli`.

This makes https://github.com/rust-lang/rustup/pull/3022 less pressing. (Instead of teaching RA about rustup components, we simply teach it to look in the sysroot via `rustc --print sysroot`. If it can't find `proc-macro-srv-cli`, it falls back to its own `proc-macro` subcommand).

This is closely related to https://github.com/rust-lang/rust-analyzer/issues/12803 (but doesn't close it yet).

Things to address now:

  * [ ] What should the binary be named? What should the crate be named? We can pick different names with `[bin]` in the `Cargo.toml`

Things to address later:

  * Disable the "multi ABI compatibility scheme" when building that binary in Rust CI (that'll probably happen in `rust-lang/rust`)
  * Teaching RA to look in the sysroot

Things to address much, much later:

  * Is JSON a good fit here
  * Do we want to add versioning to future-proof it?
  * Other bikesheds

When built with `--features sysroot` on `nightly-2022-07-23-x86_64-unknown-linux-gnu`, the binary is 7.4MB. After stripping debuginfo, it's 2.6MB. When compressed to `.tar.xz`, it's 619KB.

In a Zulip discussion, `@jyn514` and `@Mark-Simulacrum` seemed to think that those sizes weren't a stopper for including the binary in the rustc component, even before we shrink it down further.

23 months agofix: Insert spaces when inlining a function defined in a macro.
Zachary S [Mon, 25 Jul 2022 20:43:25 +0000 (15:43 -0500)]
fix: Insert spaces when inlining a function defined in a macro.

23 months agoAllow specifying sysroot OR sysroot_src
Amos Wenger [Mon, 25 Jul 2022 15:52:38 +0000 (17:52 +0200)]
Allow specifying sysroot OR sysroot_src

23 months agoFix mix up in comments
Amos Wenger [Mon, 25 Jul 2022 14:59:10 +0000 (16:59 +0200)]
Fix mix up in comments

23 months agoGate and rename binary, use it if it's in the sysroot
Amos Wenger [Mon, 25 Jul 2022 14:22:39 +0000 (16:22 +0200)]
Gate and rename binary, use it if it's in the sysroot

23 months agoRemember the difference between 'sysroot root' and 'sysroot src root', start looking...
Amos Wenger [Mon, 25 Jul 2022 14:07:41 +0000 (16:07 +0200)]
Remember the difference between 'sysroot root' and 'sysroot src root', start looking in there for a rust-analyzer-proc-macro-srv binary

23 months agoName the binary 'proc-macro-srv'
Amos Wenger [Sun, 24 Jul 2022 12:53:20 +0000 (14:53 +0200)]
Name the binary 'proc-macro-srv'

23 months agoReturn result directly
Amos Wenger [Sun, 24 Jul 2022 12:50:30 +0000 (14:50 +0200)]
Return result directly

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
23 months agoAdd doc comment to pass tidy check
Amos Wenger [Sat, 23 Jul 2022 22:48:20 +0000 (00:48 +0200)]
Add doc comment to pass tidy check

23 months agoAdd a proc-macro-srv-cli crate
Amos Wenger [Sat, 23 Jul 2022 20:47:34 +0000 (22:47 +0200)]
Add a proc-macro-srv-cli crate

23 months agoAuto merge of #12871 - fasterthanlime:sync-from-rust-2, r=Veykril
bors [Mon, 25 Jul 2022 12:58:58 +0000 (12:58 +0000)]
Auto merge of #12871 - fasterthanlime:sync-from-rust-2, r=Veykril

Sync from `rust-lang/rust`

This is the first subtree sync PR from `rust-lang/rust` to `rust-lang/rust-analyzer`, made by following the instructions at: https://doc.rust-lang.org/nightly/clippy/development/infrastructure/sync.html#performing-the-sync-from-rust-langrust-to-clippy

It includes all the commits that were made in:

  * https://github.com/rust-lang/rust/pull/99603

(And that were reviewed ahead of time by `@Veykril` + `@lnicola)`

23 months agorevert nightly rustfmt formatting that accidentally slipped in
Amos Wenger [Mon, 25 Jul 2022 12:18:28 +0000 (14:18 +0200)]
revert nightly rustfmt formatting that accidentally slipped in

cf. https://github.com/rust-lang/rust/pull/99603
cf. https://github.com/rust-lang/rust-analyzer/pull/12871#discussion_r928816339

23 months agoMerge remote-tracking branch 'origin/master' into sync-from-rust-2
Amos Wenger [Mon, 25 Jul 2022 12:07:07 +0000 (14:07 +0200)]
Merge remote-tracking branch 'origin/master' into sync-from-rust-2

23 months agoAuto merge of #12856 - Veykril:multi-proc-srv, r=Veykril
bors [Mon, 25 Jul 2022 10:41:05 +0000 (10:41 +0000)]
Auto merge of #12856 - Veykril:multi-proc-srv, r=Veykril

feat: Spawn a proc-macro-srv instance per workspace

cc https://github.com/rust-lang/rust-analyzer/issues/12855

The idea is to have each server be spawned with the appropriate toolchain, that way workspaces with differing toolchains shouldn't suffer from proc-macro abi mismatches.

23 months agoAuto merge of #12868 - lowr:follow-up-on-12832, r=lnicola
bors [Mon, 25 Jul 2022 10:15:08 +0000 (10:15 +0000)]
Auto merge of #12868 - lowr:follow-up-on-12832, r=lnicola

Replace `debug_assert!` with `stdx::always!`

Addresses https://github.com/rust-lang/rust-analyzer/pull/12832#issuecomment-1193713473

23 months agoReplace `debug_assert!` with `stdx::always!`
Ryo Yoshida [Mon, 25 Jul 2022 09:40:35 +0000 (18:40 +0900)]
Replace `debug_assert!` with `stdx::always!`

23 months agoMake macros test order-resistant
Amos Wenger [Sun, 24 Jul 2022 14:48:06 +0000 (16:48 +0200)]
Make macros test order-resistant

23 months agoAuto merge of #12861 - DorianListens:dscheidt/complete-field, r=DorianListens
bors [Sun, 24 Jul 2022 14:11:35 +0000 (14:11 +0000)]
Auto merge of #12861 - DorianListens:dscheidt/complete-field, r=DorianListens

fix: Autocomplete for struct fields includes receiver

fixes #12857

23 months agoSort when iterating through CrateGraph
Amos Wenger [Sun, 24 Jul 2022 14:11:05 +0000 (16:11 +0200)]
Sort when iterating through CrateGraph

23 months agofix: Autocomplete for struct fields includes receiver
Dorian Scheidt [Sun, 24 Jul 2022 05:29:07 +0000 (00:29 -0500)]
fix: Autocomplete for struct fields includes receiver

fixes #12857

23 months agoSort in DefMap::dump, since HashMap iteration order isn't defined
Amos Wenger [Sun, 24 Jul 2022 14:04:20 +0000 (16:04 +0200)]
Sort in DefMap::dump, since HashMap iteration order isn't defined

23 months agoAuto merge of #12863 - lowr:fix/missing-fields-on-destructuring-assignment, r=Veykril
bors [Sun, 24 Jul 2022 13:57:14 +0000 (13:57 +0000)]
Auto merge of #12863 - lowr:fix/missing-fields-on-destructuring-assignment, r=Veykril

Fix missing fields check on destructuring assignment

Fixes #12838

When checking if the record literal in question is an assignee expression or not, the new fn `is_assignee_record_literal` iterates over its ancestors until it is sure. This isn't super efficient, as we don't cache anything and does the iteration for every record literal during missing fields check. Alternatively, we may want to have a field like `assignee` on `hir_def::Expr::{RecordLit, Array, Tuple, Call}` to tell if it's an assignee expression, which would be O(1) when checking later but have some memory overhead for the field.

23 months agohir-def tests: sort results before comparing, since FxHashSet iteration order isn...
Amos Wenger [Sun, 24 Jul 2022 13:55:20 +0000 (15:55 +0200)]
hir-def tests: sort results before comparing, since FxHashSet iteration order isn't guaranteed

(And, in fact, it failed on i686)

23 months agofix: consider assignee expressions in record fields exhaustiveness check
Ryo Yoshida [Sun, 24 Jul 2022 13:34:53 +0000 (22:34 +0900)]
fix: consider assignee expressions in record fields exhaustiveness check

23 months agoAdd info whether it's assignee expr to relevant HIR `Expr` variants
Ryo Yoshida [Sun, 24 Jul 2022 13:32:49 +0000 (22:32 +0900)]
Add info whether it's assignee expr to relevant HIR `Expr` variants

23 months agoAuto merge of #12832 - lowr:fix/impl-default-members-no-codegen, r=Veykril
bors [Sun, 24 Jul 2022 12:46:08 +0000 (12:46 +0000)]
Auto merge of #12832 - lowr:fix/impl-default-members-no-codegen, r=Veykril

fix: don't replace default members' body

cc #12779, #12821
addresses https://github.com/rust-lang/rust-analyzer/pull/12821#issuecomment-1190157506

`gen_trait_fn_body()` only attempts to implement required trait member functions, so we shouldn't call it for `Implement default members` assist.

This patch also documents the precondition of `gen_trait_fn_body()` and inserts `debug_assert!`, but I'm not entirely sure if the assertions are appropriate.

23 months agoFix .gitattributes for test_data
Amos Wenger [Sun, 24 Jul 2022 12:05:35 +0000 (14:05 +0200)]
Fix .gitattributes for test_data