Commit Graph

25871 Commits

Author SHA1 Message Date
bors
baee6b338b Auto merge of #15406 - lowr:fix/panic-missing-impl-self-ty, r=lnicola
Don't provide `generate_default_from_new` when impl self ty is missing

Also don't provide the assist when the `Default` trait can't be found.

Part of #15398
2023-08-06 18:30:09 +00:00
Ryo Yoshida
582917453b
Don't provide generate_default_from_new when impl self ty is missing
Also don't provide the assist when the `Default` trait can't be found.
2023-08-07 03:23:41 +09:00
bors
70fa270637 Auto merge of #15401 - Veykril:disabled-proc-macro, r=Veykril
internal: Turn unresolved proc macro expansions into missing expressions

Reduces the amount of type related errors one gets when proc macro expansion is disabled.
2023-08-05 18:01:46 +00:00
Lukas Wirth
042be329a7 Turn unresolved proc macro expansions into missing expressions 2023-08-05 20:00:37 +02:00
bors
5e1394eb37 Auto merge of #15397 - lnicola:fallible-generate-delegate-trait, r=lnicola
fix: Remove unwraps from "Generate delegate trait"

Fixes #15388

This is untested and purely mechanical, maybe some of those `unwrap`s actually made sense, but it probably doesn't hurt to avoid them.
2023-08-05 16:24:49 +00:00
Laurențiu Nicola
622b18e579 Remove unwraps from Generate delegate trait 2023-08-05 19:23:56 +03:00
bors
eed86c0d98 Auto merge of #15392 - Wilfred:stopped_color, r=lnicola
Use the warning color when rust-analyzer is stopped

If the rust-analyzer server isn't running, we can't do much. Treat this state as a warning color, so it's more obvious.
2023-08-05 12:20:39 +00:00
bors
27e2eea54f Auto merge of #15393 - Wilfred:full_moniker_param, r=Veykril
SCIP: Qualify parameters by the containing function

SCIP requires symbols to be unique, but multiple functions may have a parameter with the same name. Qualify parameters according to the containing function.
2023-08-05 08:33:05 +00:00
Wilfred Hughes
edabffbd5a SCIP: Qualify parameters by the containing function
SCIP requires symbols to be unique, but multiple functions may have a
parameter with the same name. Qualify parameters according to the
containing function.
2023-08-04 16:38:31 -07:00
bors
86b6b6f705 Auto merge of #15391 - Wilfred:default_click_action, r=Veykril
Set the default status bar action to openLogs

Previously, clicking 'rust-analyzer' would stop the server entirely. This was easy to do accidentally, and then the user has to wait for the server to start up again.
2023-08-04 20:05:01 +00:00
Wilfred Hughes
253d68459d Use the warning color when rust-analyzer is stopped
If the rust-analyzer server isn't running, we can't do much. Treat
this state as a warning color, so it's more obvious.
2023-08-04 11:07:22 -07:00
Wilfred Hughes
1e76b11a20 Set the default status bar action to openLogs
Previously, clicking 'rust-analyzer' would stop the server
entirely. This was easy to do accidentally, and then the user has to
wait for the server to start up again.
2023-08-04 11:03:41 -07:00
bors
c59bd2dc3f Auto merge of #15390 - HKalbasi:mir, r=HKalbasi
Improve mir interpreter performance by caching
2023-08-04 13:17:34 +00:00
hkalbasi
cc5664c5a2 Add rustc comment into while desugaring 2023-08-04 16:35:13 +03:30
hkalbasi
3115d6988f Improve mir interpreter performance by caching 2023-08-04 16:05:54 +03:30
bors
e37ec7262c Auto merge of #15373 - tadeokondrak:desugar-while-to-loop, r=HKalbasi
internal: Desugar while to loop and break

I was reading through rust-analyzer's code and was wondering why this wasn't desugared into a loop.
2023-08-04 07:26:18 +00:00
bors
d398ad3326 Auto merge of #15380 - HKalbasi:mir, r=HKalbasi
Fix unsized struct problems in mir eval
2023-08-02 14:28:41 +00:00
hkalbasi
6990d0f26a Fix unsized struct problems in mir eval 2023-08-02 17:36:11 +03:30
bors
2f2cf21da5 Auto merge of #15348 - max-heller:issue-14692, r=lowr
Exclude non-identifier aliases from completion filtering text

When building `CompletionItem`s, this excludes aliases that aren't valid identifiers from the "lookup" text used to filter completions in the LSP client. Including them results in weird completion filtering behavior e.g. `Partial>` matching a completion for the `PartialOrd` trait because it has a doc alias of ">".

Closes #14692
2023-08-02 13:39:58 +00:00
bors
30f526c598 Auto merge of #15378 - Veykril:import-use-rename, r=Veykril
Name change Import to Use in hir-def, add unused placeholder variants for UseId

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-02 13:06:10 +00:00
Lukas Wirth
ecb6d07d57 Add currently unused UseId variants 2023-08-02 14:53:45 +02:00
Lukas Wirth
f86f6a89eb Change terminology, do not name use items and use trees as imports 2023-08-02 14:19:38 +02:00
bors
12cb6e7327 Auto merge of #15377 - Veykril:extern-crate-decl, r=Veykril
Add ExternCrateDecl to HIR

Adding these doesn't really require much design effort as they represent a single import, unlike use trees which are one item that represent 0 or more imports.

We only resolve to this definition when actually resolving on the name or alias of an `extern crate name as alias` item, not usages yet as that requires far more changes that won't lead anywhere without giving it more thought. Nevertheless the changes slightly improve IDE things, an example being hover on the decl showing the merged doc comments for example.

cc https://github.com/rust-lang/rust-analyzer/issues/14079
2023-08-02 10:27:30 +00:00
Lukas Wirth
6e2c3f610b Remove suspicious unwrap 2023-08-02 12:18:10 +02:00
Lukas Wirth
bcff166b3a Add ExternCrateDecl to HIR 2023-08-02 11:52:55 +02:00
bors
8e18b0f28c Auto merge of #15376 - Veykril:match-to-matches, r=Veykril
Allow match to matches assist to trigger on non-literal bool arms
2023-08-02 08:18:43 +00:00
bors
5945ef9946 Auto merge of #15375 - Veykril:hygiene, r=Veykril
Simplify
2023-08-02 08:03:57 +00:00
Tadeo Kondrak
92a97c292a hir: Remove Expr::While
The previous commit desugared it to a loop.
2023-08-01 19:08:16 -06:00
Tadeo Kondrak
31bcba84f9 hir: Desugar while to loop and break 2023-08-01 19:04:36 -06:00
Max Heller
a743903cf0 remove unicode-ident dependency 2023-08-01 18:18:12 -04:00
Lukas Wirth
75607fc34c Simplify 2023-08-01 17:47:52 +02:00
bors
151c750dac Auto merge of #15367 - Veykril:eager-macro-inputs, r=Veykril
fix: Strip unused token ids from eager macro input token maps
2023-08-01 11:23:02 +00:00
Lukas Wirth
a5059da57a Update test fixture 2023-08-01 13:13:56 +02:00
Lukas Wirth
e14d84d0a6 Skip out on single-segment immediate macro resolution when there are errors 2023-08-01 12:38:53 +02:00
Lukas Wirth
3c1c319c88 Allow match to matches assist to trigger on non-literal bool arms 2023-08-01 12:10:38 +02:00
bors
62dcf39ef0 Auto merge of #14723 - obsgolem:master, r=Veykril
Added remove unused imports assist

This resolves the most important part of #5131. I needed to make a couple of cosmetic changes to the search infrastructure to do this.

A few open questions:
* Should imports that don't resolve to anything be considered unused? I figured probably not, but it would be a trivial change to make if we want it.
* Is there a cleaner way to make the edits to the use list?
* Is there a cleaner way to get the list of uses that intersect the current selection?
* Is the performance acceptable? When testing this on itself, it takes a good couple seconds to perform the assist.
* Is there a way to hide the rustc diagnostics that overlap with this functionality?
2023-08-01 09:50:16 +00:00
bors
43ecf2944d Auto merge of #15358 - Veykril:no-merges, r=Veykril
Add triagebot no-merges config

cc https://github.com/rust-lang/triagebot/pull/1704 https://github.com/rust-lang/rust/pull/114157
2023-08-01 09:35:44 +00:00
Lukas Wirth
d999d34e39 Don't bail eager expansion when inner macros fail to resolve 2023-08-01 11:26:30 +02:00
bors
c71e1368fd Auto merge of #15269 - DropDemBits:structured-snippets-deferred-rendering, r=Veykril
internal: Defer structured snippet rendering to allow escaping snippet bits

Since we know exactly where snippets are, we can transparently escape snippet bits to the exact text edits that need it, and not have to do it for anything other text edits.

Also will eventually fix #11006 once all assists are migrated. This comes as a side-effect of text edits that don't have snippets get marked as having no insert formatting at all.
2023-08-01 09:18:46 +00:00
bors
f6bffa4dd3 Auto merge of #15345 - lowr:fix/add_missing_match_arms-upmap-failure, r=Veykril
Don't provide `add_missing_match_arms` assist when upmapping match arm list failed

Fixes #15310

We shouldn't provide the assist when we fail to find the original match arm list.

Note that this PR will temporarily make the assist not applicable when attribute macro operates on the match expression in question, just like the case in #15310, for most of the current stable toolchain users. This is because the sysroot-abi proc-macro-srv on the current stable [discards] spans for `Group` delimiters in some code paths, which the popular `proc-macro2` crate almost always calls, and it makes the identity of match arm list's brackets lost, leading to the upmapping failure. This has been fixed by #14960, which will land in the next stable, 1.71.

[discards]: 8ede3aae28/src/tools/rust-analyzer/crates/proc-macro-srv/src/abis/abi_sysroot/ra_server.rs (L231)
2023-08-01 08:58:43 +00:00
bors
efc5a813de Auto merge of #15050 - alibektas:14957, r=Veykril
bugfix :  skip doc(hidden) default members

fixes  #14957 . I have two questions :

1.  I am definitely looking for a more idiomatic way for the things I added in `crates/ide-assists/src/utils.rs`. See `FIXME` in that file.
2. Would it be actually better to change `DefaultMethods` to something like

```rust
enum DefaultMethods {
     Only( IgnoreHidden ( bool ) ) ,
     None
}
```

instead of adding a boolean to every function that calls `crates/ide-assists/src/utils.rs::filter_assoc_items`
2023-08-01 08:38:36 +00:00
Lukas Wirth
c7b34e4873 fix: Strip unused token ids from eager macro input token maps 2023-07-31 17:12:17 +02:00
bors
8202b5aaa7 Auto merge of #15366 - Veykril:eager-macro-inputs, r=Veykril
fix: Remove another faulty unwrap (expect)

Like the other ones, this also results in a panic when writing out `include!`  due to the missing tt
2023-07-31 15:09:34 +00:00
Lukas Wirth
bf5624664d fix: Remove another faulty unwrap (expect) 2023-07-31 16:47:45 +02:00
bors
7736b656e2 Auto merge of #15361 - Veykril:eager-macro-inputs, r=Veykril
fix: Expand eager macros to delimited comma separated expression list

Prior to this, we were just parsing it as an expression which works fine for `()` and `[]` calls as those are tuple and array expressions respectively, but if tails for `{}` calls which with my recent changes reported errors for such eager macro invocations.
2023-07-31 14:24:29 +00:00
Max Heller
91581becac update tests 2023-07-30 16:01:59 -04:00
bors
429a3816ad Auto merge of #15363 - HKalbasi:mir, r=HKalbasi
Support `Self` without field in mir lowering
2023-07-30 19:36:50 +00:00
hkalbasi
a9d81ae89c Support Self in mir lowering 2023-07-30 23:05:10 +03:30
bors
cecbed98d8 Auto merge of #15360 - lowr:fix/mbe-transcribe-path-of-different-types, r=HKalbasi
Fixup path fragments upon MBE transcription

Fixes #14367

There are roughly two types of paths: paths in expression context, where a separator `::` between an identifier and its following generic argument list is mandatory, and paths in type context, where `::` can be omitted.

Unlike rustc, we need to transform the parsed fragments back into tokens during transcription. When the matched path fragment is a type-context path and is transcribed as an expression-context path, verbatim transcription would cause a syntax error.

This PR fixes up path fragments by inserting `::` to make sure they are syntactically correct in all contexts. Note that this works because expression-context paths are a strict superset of type-context paths.
2023-07-30 17:29:36 +00:00
Lukas Wirth
7c765d9f9e fix: Expand eager macros to delimited comma separated expression list 2023-07-30 17:31:26 +02:00