]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agofix: remove insufficient check for coloncolon
yue4u [Sat, 19 Nov 2022 16:29:02 +0000 (01:29 +0900)]
fix: remove insufficient check for coloncolon

20 months agoUpdate crates/ide-completion/src/context.rs
yue [Sat, 19 Nov 2022 15:58:59 +0000 (00:58 +0900)]
Update crates/ide-completion/src/context.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
20 months agofix: filter unnecessary completions after colon
yue4u [Sat, 12 Nov 2022 13:33:40 +0000 (22:33 +0900)]
fix: filter unnecessary completions after colon

20 months agoAuto merge of #13607 - Veykril:proc-macro-error, r=Veykril
bors [Fri, 11 Nov 2022 15:57:30 +0000 (15:57 +0000)]
Auto merge of #13607 - Veykril:proc-macro-error, r=Veykril

internal: Add version info to unsupported proc macro abi error

cc https://github.com/rust-lang/rust-analyzer/issues/13589#issuecomment-1311824473

20 months agointernal: Add version info to unsupported proc macro abi error
Lukas Wirth [Fri, 11 Nov 2022 15:57:05 +0000 (16:57 +0100)]
internal: Add version info to unsupported proc macro abi error

20 months agoAuto merge of #13606 - Veykril:trait-alias, r=Veykril
bors [Fri, 11 Nov 2022 14:26:15 +0000 (14:26 +0000)]
Auto merge of #13606 - Veykril:trait-alias, r=Veykril

fix: Add trait alias grammar to rust.ungram

We already parse them, but the grammar was never updated to reflect that

20 months agofix: Add trait alias grammar to rust.ungram
Lukas Wirth [Fri, 11 Nov 2022 14:25:15 +0000 (15:25 +0100)]
fix: Add trait alias grammar to rust.ungram

20 months agoAuto merge of #13605 - Veykril:empty-ws-error, r=Veykril
bors [Fri, 11 Nov 2022 13:37:27 +0000 (13:37 +0000)]
Auto merge of #13605 - Veykril:empty-ws-error, r=Veykril

fix: Fix r-a eagerly showing no discovered workspace errors

20 months agofix: Fix r-a eagerly showing no discovered workspace errors
Lukas Wirth [Fri, 11 Nov 2022 13:36:27 +0000 (14:36 +0100)]
fix: Fix r-a eagerly showing no discovered workspace errors

20 months agoAuto merge of #13604 - Veykril:hover-attr, r=Veykril
bors [Fri, 11 Nov 2022 12:48:48 +0000 (12:48 +0000)]
Auto merge of #13604 - Veykril:hover-attr, r=Veykril

fix: Fix hover in attributed items not preferring similar kinded tokens

20 months agofix: Fix hover in attributed items not preferring similar kinded tokens
Lukas Wirth [Fri, 11 Nov 2022 12:38:07 +0000 (13:38 +0100)]
fix: Fix hover in attributed items not preferring similar kinded tokens

20 months agoAuto merge of #13602 - lowr:fix/nameres-transitive-visibility, r=Veykril
bors [Fri, 11 Nov 2022 12:32:21 +0000 (12:32 +0000)]
Auto merge of #13602 - lowr:fix/nameres-transitive-visibility, r=Veykril

fix: check visibility of each path segment

Upon path resolution, we have not been checking if every def pointed to by each segment of the path is visible from the original module. This leads to incorrect import resolutions, in particular when one uses glob imports and names collide.

There is decent amount of changes in this PR because:
- some of our tests were not correct in terms of visibility
  - I left several basic nameres tests as-is (with expect test updated) since I thought it would be nice to ensure we don't resolve defs that are not visible.
- `fix_visibility` assist relied on `Semantics::resolve_path()`, which uses the name resolution procedure I'm fixing and wouldn't be able to "see through" the items with strict visibility with this patch

The first commit is the gist of the fix itself.

Fixes #10991
Fixes #11473
Fixes #13252

20 months agoAuto merge of #13548 - lowr:fix/tt-punct-spacing, r=Veykril
bors [Fri, 11 Nov 2022 12:19:30 +0000 (12:19 +0000)]
Auto merge of #13548 - lowr:fix/tt-punct-spacing, r=Veykril

Fix `tt::Punct`'s spacing calculation

Fixes #13499

We currently set a `tt::Punct`'s spacing to `Spacing::Joint` unless its next token is a trivia (i.e. whitespaces or comment). As I understand it, rustc only [sets `Spacing::Joint` if the next token is an operator](https://github.com/rust-lang/rust/blob/5b3e9090757da9a95b22f589fe39b6a4b5455b96/compiler/rustc_parse/src/lexer/tokentrees.rs#L77-L78) and we should follow it to guarantee the consistent behavior of proc macros.

20 months agoAuto merge of #13603 - Veykril:no-workspaces, r=Veykril
bors [Fri, 11 Nov 2022 12:01:52 +0000 (12:01 +0000)]
Auto merge of #13603 - Veykril:no-workspaces, r=Veykril

fix: Send status notification if there are no found workspaces

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

20 months agoSend status notification if there are no found workspaces
Lukas Wirth [Fri, 11 Nov 2022 12:00:22 +0000 (13:00 +0100)]
Send status notification if there are no found workspaces

20 months agoFix tests that depended on loose visibility restriction
Ryo Yoshida [Fri, 11 Nov 2022 10:59:52 +0000 (19:59 +0900)]
Fix tests that depended on loose visibility restriction

20 months agoResolve invisible defs in `fix_visibility` assist
Ryo Yoshida [Fri, 11 Nov 2022 10:56:47 +0000 (19:56 +0900)]
Resolve invisible defs in `fix_visibility` assist

20 months agofix: check visibility of each segment in path resolution
Ryo Yoshida [Fri, 11 Nov 2022 10:50:26 +0000 (19:50 +0900)]
fix: check visibility of each segment in path resolution

20 months agoTest `TokenTree`s' equality modulo `Punct`s' spacing
Ryo Yoshida [Thu, 10 Nov 2022 10:24:01 +0000 (19:24 +0900)]
Test `TokenTree`s' equality modulo `Punct`s' spacing

20 months agoIgnore outermost non-delimited `Subtree` when reversing fixups
Ryo Yoshida [Thu, 10 Nov 2022 10:22:20 +0000 (19:22 +0900)]
Ignore outermost non-delimited `Subtree` when reversing fixups

20 months agoAuto merge of #13590 - Veykril:proc-macro-rustc-src, r=Veykril
bors [Wed, 9 Nov 2022 19:51:20 +0000 (19:51 +0000)]
Auto merge of #13590 - Veykril:proc-macro-rustc-src, r=Veykril

internal: Add proc-macro dependency to rustc_private crates

20 months agoAdd proc-macro dependency to rustc_private crates
Lukas Wirth [Wed, 9 Nov 2022 19:50:18 +0000 (20:50 +0100)]
Add proc-macro dependency to rustc_private crates

20 months agoAuto merge of #13584 - jonas-schievink:fix-signature-panic, r=jonas-schievink
bors [Tue, 8 Nov 2022 17:27:13 +0000 (17:27 +0000)]
Auto merge of #13584 - jonas-schievink:fix-signature-panic, r=jonas-schievink

fix: fix panic when computing signature of generic `FnOnce` callable

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

20 months agoDon't canonicalize self type when querying FnOnce signature
Jonas Schievink [Tue, 8 Nov 2022 17:05:07 +0000 (18:05 +0100)]
Don't canonicalize self type when querying FnOnce signature

20 months agoAuto merge of #13582 - lnicola:nest-cargo-toml, r=lnicola
bors [Tue, 8 Nov 2022 08:44:43 +0000 (08:44 +0000)]
Auto merge of #13582 - lnicola:nest-cargo-toml, r=lnicola

feat: Nest Cargo.lock under Cargo.toml in Code

Closes #13580

20 months agoNest Cargo.lock under Cargo.toml in Code
Laurențiu Nicola [Tue, 8 Nov 2022 07:57:05 +0000 (09:57 +0200)]
Nest Cargo.lock under Cargo.toml in Code

20 months agoAuto merge of #13581 - Veykril:unit-struct-compl, r=Veykril
bors [Tue, 8 Nov 2022 07:38:13 +0000 (07:38 +0000)]
Auto merge of #13581 - Veykril:unit-struct-compl, r=Veykril

fix: Fix item completions not working properly after unit structs and outline modules

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

20 months agofix: Fix item completions not working properly after unit structs and outline modules
Lukas Wirth [Tue, 8 Nov 2022 07:37:45 +0000 (08:37 +0100)]
fix: Fix item completions not working properly after unit structs and outline modules

20 months agoAuto merge of #13573 - Veykril:invalid-file-range, r=Veykril
bors [Mon, 7 Nov 2022 16:45:26 +0000 (16:45 +0000)]
Auto merge of #13573 - Veykril:invalid-file-range, r=Veykril

internal: error instead of panic on invalid file range

Fixes the panic in https://github.com/rust-lang/rust-analyzer/issues/13170

20 months agointernal: error instead of panic on invalid file range
Lukas Wirth [Mon, 7 Nov 2022 16:43:22 +0000 (17:43 +0100)]
internal: error instead of panic on invalid file range

20 months agoAuto merge of #13572 - Veykril:cancellable, r=Veykril
bors [Mon, 7 Nov 2022 16:22:33 +0000 (16:22 +0000)]
Auto merge of #13572 - Veykril:cancellable, r=Veykril

internal: Use Cancellable in favor of Result for clarity

20 months agointernal: Use Cancellable in favor of Result for clarity
Lukas Wirth [Mon, 7 Nov 2022 16:21:37 +0000 (17:21 +0100)]
internal: Use Cancellable in favor of Result for clarity

20 months agoAuto merge of #13571 - Veykril:unique-references, r=Veykril
bors [Mon, 7 Nov 2022 15:49:54 +0000 (15:49 +0000)]
Auto merge of #13571 - Veykril:unique-references, r=Veykril

minor: Deduplicate reference search results

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

20 months agoDeduplicate reference search results
Lukas Wirth [Mon, 7 Nov 2022 15:48:50 +0000 (16:48 +0100)]
Deduplicate reference search results

20 months agoAuto merge of #13568 - noritada:fix/len-of-byte-string-with-escaped-newlines, r=Veykril
bors [Mon, 7 Nov 2022 15:04:40 +0000 (15:04 +0000)]
Auto merge of #13568 - noritada:fix/len-of-byte-string-with-escaped-newlines, r=Veykril

Fix the length displayed for byte string literals with escaped newlines

This is a fix for the problem I reported earlier: "the length of byte strings containing escaped newlines is displayed two bytes longer when the first escaped character is a newline".

I would appreciate it if you could review the fix.
Many thanks.

Closes #13567

20 months agoAuto merge of #13570 - Veykril:dedup-crates-for, r=Veykril
bors [Mon, 7 Nov 2022 14:52:05 +0000 (14:52 +0000)]
Auto merge of #13570 - Veykril:dedup-crates-for, r=Veykril

minor: Remove code duplication

20 months agoRemove code duplication
Lukas Wirth [Mon, 7 Nov 2022 14:49:26 +0000 (15:49 +0100)]
Remove code duplication

20 months agoAdd test code for unescaping byte strings
Noritada Kobayashi [Mon, 7 Nov 2022 14:39:02 +0000 (23:39 +0900)]
Add test code for unescaping byte strings

20 months agoAuto merge of #13545 - Veykril:adjustment-hints, r=Veykril
bors [Mon, 7 Nov 2022 14:38:59 +0000 (14:38 +0000)]
Auto merge of #13545 - Veykril:adjustment-hints, r=Veykril

Generalize reborrow hints as adjustment hints

Like reborrow hints, these are still mainly useful for teaching/learning

![image](https://user-images.githubusercontent.com/3757771/200073606-b5cd3b95-a9ad-454d-a3c4-d4d89bf45928.png)

20 months agoAuto merge of #13569 - Veykril:rust-version, r=Veykril
bors [Mon, 7 Nov 2022 14:21:31 +0000 (14:21 +0000)]
Auto merge of #13569 - Veykril:rust-version, r=Veykril

Bump Cargo rust-version fields to latest stable

We already depend on `let ... else` now anyways

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

20 months agoClarify the intent
Noritada Kobayashi [Mon, 7 Nov 2022 13:51:29 +0000 (22:51 +0900)]
Clarify the intent

Thanks to Lukas Wirth for a suggestion.

20 months agoBump Cargo rust-version fields to latest stable
Lukas Wirth [Mon, 7 Nov 2022 11:59:51 +0000 (12:59 +0100)]
Bump Cargo rust-version fields to latest stable

20 months agoDon't trigger adjustment hints in all inlay hint tests
Lukas Wirth [Mon, 7 Nov 2022 11:49:52 +0000 (12:49 +0100)]
Don't trigger adjustment hints in all inlay hint tests

20 months agoAuto merge of #13565 - Veykril:sysroot, r=Veykril
bors [Mon, 7 Nov 2022 11:40:44 +0000 (11:40 +0000)]
Auto merge of #13565 - Veykril:sysroot, r=Veykril

Update sysroot crates

20 months agoFix the length displayed for byte string literals with escaped newlines
Noritada Kobayashi [Mon, 7 Nov 2022 10:25:07 +0000 (19:25 +0900)]
Fix the length displayed for byte string literals with escaped newlines

The length of byte strings containing escaped newlines is displayed two
bytes longer when the first escaped character is a newline.

This is due to a small bug in handling the first escaped newline in
string literals.

Closes #13567

20 months agoAuto merge of #12991 - TiddoLangerak:extract-method-from-trait-into-impl-root, r...
bors [Mon, 7 Nov 2022 11:07:12 +0000 (11:07 +0000)]
Auto merge of #12991 - TiddoLangerak:extract-method-from-trait-into-impl-root, r=Veykril

Feat: extracted method from trait impl is placed in existing impl

**Before**

https://user-images.githubusercontent.com/1759192/183872883-3b0eafd2-d1dc-440e-9e66-38e3372f8b64.mp4

**After**

https://user-images.githubusercontent.com/1759192/183875769-87f34c7d-52f0-4dfc-9766-f591ee738ebb.mp4

Previously, when triggering a method extraction from within an impl trait block, then this would always create a new impl block for
the struct, even if there already is one. Now, if there is already an existing trait-less impl block, then it'll put the extracted method in there.

**Caveats**:
- It currently requires the target impl block to be non-empty. This limitation is because the current architecture takes a `node_to_insert_after` as reference for where to insert the extracted function. An empty impl block doesn't have such a reference node, since it's empty. It seems that supporting this requires a much larger and more complex change.
- This is my first contribution in rust, so apologies for any beginner mistakes.

20 months agoUpdate sysroot crates
Lukas Wirth [Mon, 7 Nov 2022 10:45:52 +0000 (11:45 +0100)]
Update sysroot crates

20 months agorustfmt
Lukas Wirth [Mon, 7 Nov 2022 10:58:57 +0000 (11:58 +0100)]
rustfmt

20 months agoAuto merge of #13566 - lnicola:therefor, r=lnicola
bors [Mon, 7 Nov 2022 10:54:38 +0000 (10:54 +0000)]
Auto merge of #13566 - lnicola:therefor, r=lnicola

minor: Fix typos

20 months agoFix typos
Laurențiu Nicola [Mon, 7 Nov 2022 10:53:33 +0000 (12:53 +0200)]
Fix typos

20 months agoAuto merge of #13547 - Veykril:line-index, r=Veykril
bors [Mon, 7 Nov 2022 10:33:13 +0000 (10:33 +0000)]
Auto merge of #13547 - Veykril:line-index, r=Veykril

internal: Optimize `apply_document_changes` a bit

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

20 months agoAuto merge of #13552 - Veykril:flycheck-process-group, r=Veykril
bors [Mon, 7 Nov 2022 10:19:32 +0000 (10:19 +0000)]
Auto merge of #13552 - Veykril:flycheck-process-group, r=Veykril

internal: Use a process group for flycheck

Should fix https://github.com/rust-lang/rust-analyzer/issues/13348

20 months agoAuto merge of #13556 - pd4d10:patch-1, r=lnicola
bors [Sat, 5 Nov 2022 17:57:31 +0000 (17:57 +0000)]
Auto merge of #13556 - pd4d10:patch-1, r=lnicola

docs: fix adoc links

Correct #13536 with adoc link syntax

20 months agodocs: fix adoc links
Rongjian Zhang [Sat, 5 Nov 2022 17:33:57 +0000 (01:33 +0800)]
docs: fix adoc links

20 months agointernal: Use a process group for flycheck
Lukas Wirth [Sat, 5 Nov 2022 15:28:04 +0000 (16:28 +0100)]
internal: Use a process group for flycheck

20 months agoAuto merge of #13550 - Veykril:issue-template, r=lnicola
bors [Sat, 5 Nov 2022 13:20:26 +0000 (13:20 +0000)]
Auto merge of #13550 - Veykril:issue-template, r=lnicola

minor: Update github issue templates

20 months agoAuto merge of #13536 - pd4d10:patch-1, r=Veykril
bors [Sat, 5 Nov 2022 12:59:05 +0000 (12:59 +0000)]
Auto merge of #13536 - pd4d10:patch-1, r=Veykril

docs: add crates section to the manual

closes #13533

Added a section to the user manual, to make it easier for users to find the correct crate.

20 months agoAuto merge of #13435 - DropDemBits:assists-format-args-capture-pt3, r=Veykril
bors [Sat, 5 Nov 2022 12:41:23 +0000 (12:41 +0000)]
Auto merge of #13435 - DropDemBits:assists-format-args-capture-pt3, r=Veykril

Migrate assists to format args captures, part 3

Continuation of https://github.com/rust-lang/rust-analyzer/pull/13379

Migrates:

- `inline_call`
- `inline_local_variable`
- `introduce_named_lifetime`
- `merge_match_arms`
- `move_from_mod_rs`
- `move_guard`
- `move_module_to_file`
- `move_to_mod_rs`
- `number_representation`
- `qualify_method_call`
- `qualify_path`
- `raw_string`
- `remove_dbg`
- `replace_derive_with_manual_impl`
- `replace_or_with_or_else`
- `replace_turbofish_with_explicit_type`
- `unwrap_tuple`
- `wrap_return_type_in_result`

20 months agominor: Update github issue templates
Lukas Wirth [Sat, 5 Nov 2022 12:29:44 +0000 (13:29 +0100)]
minor: Update github issue templates

20 months agoAuto merge of #13379 - DropDemBits:ide-assists-format-args-capture, r=Veykril
bors [Sat, 5 Nov 2022 12:29:06 +0000 (12:29 +0000)]
Auto merge of #13379 - DropDemBits:ide-assists-format-args-capture, r=Veykril

internal: Migrate `ide_assists::utils` and `ide_assists::handlers` to use format arg captures (part 1)

This not only serves as making future migration to mutable syntax trees easier, it also finds out what needs to be migrated in the first place.

~~Aside from the first commit, subsequent commits are structured to only deal with one file/handler at a time.~~

This is the first of 3 PRs, migrating:

Utils:

- `gen_trait_fn_body`
- `render_snippet`
- `ReferenceConversion`
  - `convert_type`
  - `getter`

Handlers:

- `add_explicit_type`
- `add_return_type`
- `add_turbo_fish`
- `apply_demorgan`
- `auto_import`
- `convert_comment_block`
- `convert_integer_literal`
- `convert_into_to_from`
- `convert_iter_for_each_to_for`
- `convert_let_else_to_match`
- `convert_tuple_struct_to_named_struct`
- `convert_two_arm_bool_match_to_matches_macro`
- `destructure_tuple_binding`
- `extract_function`
- `extract_module`
- `extract_struct_from_enum_variant`
- `extract_type_alias`
- `extract_variable`
- `fix_visibility`

20 months agoAuto merge of #13549 - Veykril:search-fix, r=Veykril
bors [Sat, 5 Nov 2022 12:16:18 +0000 (12:16 +0000)]
Auto merge of #13549 - Veykril:search-fix, r=Veykril

fix: Fix reference searching only accounting substrings instead of whole identifiers

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

20 months agofix: Fix reference searching only accounting substrings instead of whole identifiers
Lukas Wirth [Sat, 5 Nov 2022 11:04:21 +0000 (12:04 +0100)]
fix: Fix reference searching only accounting substrings instead of whole identifiers

20 months agoFix `tt::Punct`'s spacing calculation
Ryo Yoshida [Sat, 5 Nov 2022 10:01:26 +0000 (19:01 +0900)]
Fix `tt::Punct`'s spacing calculation

20 months agoRename convertor -> converter
Ryo Yoshida [Wed, 2 Nov 2022 14:26:29 +0000 (23:26 +0900)]
Rename convertor -> converter

20 months agoAuto merge of #13454 - justinmmott:master, r=flodiebold
bors [Sat, 5 Nov 2022 10:05:52 +0000 (10:05 +0000)]
Auto merge of #13454 - justinmmott:master, r=flodiebold

Fixed local shadowing the caller's argument issue

fix https://github.com/rust-lang/rust-analyzer/issues/12536

20 months agoAdd tests for LineEndings::normalize
Lukas Wirth [Sat, 5 Nov 2022 10:00:17 +0000 (11:00 +0100)]
Add tests for LineEndings::normalize

20 months agointernal: Optimize `apply_document_changes` a bit
Lukas Wirth [Fri, 4 Nov 2022 23:27:03 +0000 (00:27 +0100)]
internal: Optimize `apply_document_changes` a bit

20 months agoAuto merge of #13541 - Veykril:dbg-cmd, r=Veykril
bors [Fri, 4 Nov 2022 23:30:48 +0000 (23:30 +0000)]
Auto merge of #13541 - Veykril:dbg-cmd, r=Veykril

Clarify what commands are debug commands in VSCode

Renders as
![image](https://user-images.githubusercontent.com/3757771/199828895-4d7691f6-5c33-405c-9842-691b32745919.png)

20 months agoMark the Memory Usage command as debug command
Lukas Wirth [Fri, 4 Nov 2022 23:30:21 +0000 (00:30 +0100)]
Mark the Memory Usage command as debug command

20 months agoFix up adjustment hints configurations
Lukas Wirth [Fri, 4 Nov 2022 21:59:07 +0000 (22:59 +0100)]
Fix up adjustment hints configurations

20 months agoAdd adjustment hint tests
Lukas Wirth [Fri, 4 Nov 2022 21:40:06 +0000 (22:40 +0100)]
Add adjustment hint tests

20 months agoGeneralize reborrow hints as adjustment hints
Lukas Wirth [Fri, 4 Nov 2022 16:11:15 +0000 (17:11 +0100)]
Generalize reborrow hints as adjustment hints

20 months agoAuto merge of #13546 - Veykril:unsafe-fn-ptr, r=Veykril
bors [Fri, 4 Nov 2022 20:29:16 +0000 (20:29 +0000)]
Auto merge of #13546 - Veykril:unsafe-fn-ptr, r=Veykril

Lower unsafety of fn pointer and fn item types

20 months agoLower unsafety of fn pointer and fn item types
Lukas Wirth [Fri, 4 Nov 2022 20:07:15 +0000 (21:07 +0100)]
Lower unsafety of fn pointer and fn item types

20 months agoAuto merge of #13544 - HKalbasi:patch-2, r=Veykril
bors [Fri, 4 Nov 2022 16:12:21 +0000 (16:12 +0000)]
Auto merge of #13544 - HKalbasi:patch-2, r=Veykril

Add rustbot features related to PR state labels

It makes rustbot add `S-waiting-on-review` to every new PR, and ``@rustbot` author` and ``@rustbot` review` commands working.

20 months agoAdd rustbot features related to PR state labels
HKalbasi [Fri, 4 Nov 2022 11:57:50 +0000 (15:27 +0330)]
Add rustbot features related to PR state labels

20 months agoClarify what commands are debug commands in VSCode
Lukas Wirth [Thu, 3 Nov 2022 20:36:14 +0000 (21:36 +0100)]
Clarify what commands are debug commands in VSCode

20 months agoAuto merge of #13456 - emilio:scip-local-symbol, r=Veykril
bors [Thu, 3 Nov 2022 13:58:36 +0000 (13:58 +0000)]
Auto merge of #13456 - emilio:scip-local-symbol, r=Veykril

scip: Generate symbols for local crates.

Consider something like:

```
// a.rs
pub struct Foo { .. } // Foo is "local 1"

fn something() {
    crate::b::Bar::new() // Bar is "local 1", but of "b.rs"
}

// b.rs
pub struct Bar { .. } // "local 1"
```

Without this there's no way to disambiguate whether "local 1" references "Bar" or "Foo".

20 months agoAuto merge of #13537 - lnicola:ovsx-fail, r=lnicola
bors [Thu, 3 Nov 2022 13:43:38 +0000 (13:43 +0000)]
Auto merge of #13537 - lnicola:ovsx-fail, r=lnicola

minor: Allow ovsx publishing to fail

20 months agoAllow ovsx publishing to fail
Laurențiu Nicola [Thu, 3 Nov 2022 13:42:55 +0000 (15:42 +0200)]
Allow ovsx publishing to fail

20 months agodocs: add crates section to the manual
Rongjian Zhang [Thu, 3 Nov 2022 05:17:03 +0000 (13:17 +0800)]
docs: add crates section to the manual

20 months agoAuto merge of #13530 - lnicola:bump-ovsx, r=lnicola
bors [Wed, 2 Nov 2022 13:11:55 +0000 (13:11 +0000)]
Auto merge of #13530 - lnicola:bump-ovsx, r=lnicola

minor: Bump ovsx

CC https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/1330#note_1033611

20 months agoBump ovsx
Laurențiu Nicola [Wed, 2 Nov 2022 12:50:04 +0000 (14:50 +0200)]
Bump ovsx

20 months agoAuto merge of #13527 - unexge:use-let-else-stmt-in-convert-to-guarded-return-assist...
bors [Wed, 2 Nov 2022 11:06:54 +0000 (11:06 +0000)]
Auto merge of #13527 - unexge:use-let-else-stmt-in-convert-to-guarded-return-assist, r=jonas-schievink

Use let-else statements in `Convert to guarded return` assist

Follow up for https://github.com/rust-lang/rust-analyzer/pull/13516, addresses remaining part of https://github.com/rust-lang/rust-analyzer/issues/13254#issuecomment-1250408527

20 months agoAuto merge of #13359 - feniljain:feat-must-use-option, r=Veykril
bors [Wed, 2 Nov 2022 10:50:08 +0000 (10:50 +0000)]
Auto merge of #13359 - feniljain:feat-must-use-option, r=Veykril

feat: add config for inserting must_use in `generate_enum_as_method`

Should fix #13312

Didn't add a test because I was not sure on how to add test for a specific configuration option, tried to look for the usages for other `AssistConfig` variants but couldn't find any in `tests`. If there is a way to test this, do point me towards it.

I tried to extract the formatting string as a common `template_string` and only have if-else for that, but it didn't compile :(

Also it seems these tests are failing:

```
test config::tests::generate_config_documentation ... FAILED
test config::tests::generate_package_json_config ... FAILED
```

Can you also point me to how to correct these 😅  ( I guess there is some command to automatically generate these? )

20 months agofix: indentation after inserting `#must_use`
feniljain [Wed, 2 Nov 2022 10:39:12 +0000 (16:09 +0530)]
fix: indentation after inserting `#must_use`

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
20 months agoAuto merge of #13517 - feniljain:fix_completions, r=Veykril
bors [Wed, 2 Nov 2022 10:15:18 +0000 (10:15 +0000)]
Auto merge of #13517 - feniljain:fix_completions, r=Veykril

fix: make custom expr prefix completions to understand refs

Possible fix of #7929

While reviewing the postfix completion code I saw that while calling `add_custom_postfix_completions` we were doing it under the part where reference was not taken into consideration, but as we are only adding postfix completions with `Expr` scope ( [source](https://github.com/rust-lang/rust-analyzer/blob/ba28e19b7838e3ad4223ae82d074dc3950ef1548/crates/ide-completion/src/completions/postfix.rs#L272) )

I shifted the `add_custom_postfix_completions` call to part where references are considered

I am not sure if this is the correct fix or I am understanding the problem exactly but this small move seemed to have fixed the issue :)

21 months agoUse let-else statements in `Convert to guarded return` assist
unexge [Tue, 1 Nov 2022 23:02:10 +0000 (23:02 +0000)]
Use let-else statements in `Convert to guarded return` assist

21 months agoAuto merge of #13525 - jonas-schievink:generic-call-signature, r=jonas-schievink
bors [Tue, 1 Nov 2022 17:01:07 +0000 (17:01 +0000)]
Auto merge of #13525 - jonas-schievink:generic-call-signature, r=jonas-schievink

feat: show signature help when calling generic types implementing `FnOnce`

This queries chalk for the `FnOnce` impl of callees and takes argument and return types from there, making generic `Callable`s available to the IDE. This makes signature help work for them, and potentially allows other features to take generic callables into account in the future.

21 months agoAuto merge of #13508 - koka831:fix/13492, r=jonas-schievink
bors [Tue, 1 Nov 2022 16:38:40 +0000 (16:38 +0000)]
Auto merge of #13508 - koka831:fix/13492, r=jonas-schievink

fix: async trait method for `unnecessary_async`

Fix https://github.com/rust-lang/rust-analyzer/issues/13492

21 months agoAuto merge of #13516 - unexge:add-convert-match-to-let-else-assist, r=jonas-schievink
bors [Tue, 1 Nov 2022 16:24:15 +0000 (16:24 +0000)]
Auto merge of #13516 - unexge:add-convert-match-to-let-else-assist, r=jonas-schievink

Add `Convert match to let-else` assist

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

21 months agoFix doc test
Jonas Schievink [Tue, 1 Nov 2022 16:23:32 +0000 (17:23 +0100)]
Fix doc test

21 months agoRevert "Record diverging match arms in `InferenceResult`"
Jonas Schievink [Tue, 1 Nov 2022 16:18:17 +0000 (17:18 +0100)]
Revert "Record diverging match arms in `InferenceResult`"

This reverts commit 319611b7382fc4c84170519dade68f4f558a44b1.

21 months agoImport `option` in the tests
Jonas Schievink [Tue, 1 Nov 2022 16:18:13 +0000 (17:18 +0100)]
Import `option` in the tests

21 months agoCreate `Callable`s for generic types implementing `FnOnce`
Jonas Schievink [Tue, 1 Nov 2022 15:33:59 +0000 (16:33 +0100)]
Create `Callable`s for generic types implementing `FnOnce`

21 months agoAuto merge of #13523 - lowr:fix/adjust-expectation-for-if, r=lnicola
bors [Mon, 31 Oct 2022 15:39:20 +0000 (15:39 +0000)]
Auto merge of #13523 - lowr:fix/adjust-expectation-for-if, r=lnicola

fix: disregard type variable expectation for if expressions

Fixes #13522

As [the comment](https://github.com/rust-lang/rust-analyzer/blob/8142d1f606dc2e52b1d2b8992671e2bd73379f28/crates/hir-ty/src/infer.rs#L1087-L1090) on `Expectation::adjust_for_branches` explains:

> If the expected type is just a type variable, then don't use an expected type. Otherwise, we might write parts of the type when checking the 'then' block which are incompatible with the 'else' branch.

Note that we already use it in match expressions. I've added tests for them too nevertheless.

21 months agofix: disregard type variable expectation for if expressions
Ryo Yoshida [Mon, 31 Oct 2022 15:15:05 +0000 (00:15 +0900)]
fix: disregard type variable expectation for if expressions

21 months agoAuto merge of #13445 - notJoon:modify-dead-links, r=lnicola
bors [Mon, 31 Oct 2022 06:55:11 +0000 (06:55 +0000)]
Auto merge of #13445 - notJoon:modify-dead-links, r=lnicola

fix) update broken links in guide.md

Hi, I Just fixed some broken links in `guide.md`.

In most cases, it is not connected by an old version (expecially `guide-2019-01`) of the link, so I made some modifications.

Thanks for your time :)

21 months agofix: make custom expr prefix completions to understand refs
feniljain [Sun, 30 Oct 2022 09:25:44 +0000 (14:55 +0530)]
fix: make custom expr prefix completions to understand refs

21 months agoUpdate auto generated tests
unexge [Sat, 29 Oct 2022 23:00:53 +0000 (00:00 +0100)]
Update auto generated tests