Commit Graph

24737 Commits

Author SHA1 Message Date
bors
58da3fc240 Auto merge of #14517 - Veykril:hir-def-refac, r=Veykril
internal: Shuffle around some hir_def modules
2023-04-06 17:58:28 +00:00
Lukas Wirth
3f5c9920d6 Move hir_def::builtin_attr to hir_def::attr::builtin 2023-04-06 19:55:49 +02:00
Lukas Wirth
12b069f434 Move hir_def::keys to hir_def::dyn_map 2023-04-06 19:49:33 +02:00
Lukas Wirth
40c068f502 Use hir_def::builtin_attr::find_builtin_attr_idx 2023-04-06 19:44:29 +02:00
Lukas Wirth
99b69525f4 hir_def::expr -> hir_def::hir, hir_def::type_ref -> hir_def::hir::type_ref 2023-04-06 19:36:25 +02:00
Lukas Wirth
8e7c104b3a Move hir_def::adt to hir_def::data::adt 2023-04-06 19:23:29 +02:00
bors
3dd17bcfc3 Auto merge of #14512 - bvanjoi:fix-14489, r=Veykril
fix(ide): highlight escapes in char

close #14489

before:

![image](https://user-images.githubusercontent.com/30187863/230414343-16f34d31-e2a1-460b-b09f-f288b196c54e.png)

after:

![image](https://user-images.githubusercontent.com/30187863/230414581-b8c37355-6626-4745-9f2b-3d9d4f804b47.png)
2023-04-06 16:03:30 +00:00
bvanjoi
f0c74b30ed fix(ide): highlight escapes in char 2023-04-06 23:20:12 +08:00
bors
4ccc83a759 Auto merge of #14509 - Veykril:label-lower-body, r=Veykril
internal: Resolve labels in body lowering

Fixes https://github.com/rust-lang/rust-analyzer/issues/14503#issuecomment-1498951837
2023-04-06 13:58:39 +00:00
Lukas Wirth
fbb1bd5880 Re-enable controlflow outside loop diagnostic 2023-04-06 15:37:53 +02:00
Lukas Wirth
0e7117900c internal: Resolve labels in body lowering 2023-04-06 14:21:20 +02:00
bors
e9e57725aa Auto merge of #14505 - Veykril:block-trait-impls, r=Veykril
fix: Fix block local impl trait solving regressions

Fixes https://github.com/rust-lang/rust-analyzer/issues/14443
2023-04-06 08:37:33 +00:00
Lukas Wirth
1c16e4ee97 fix: Fix block local impl trait solving regressions 2023-04-06 10:37:00 +02:00
bors
e3e324d830 Auto merge of #14432 - Veykril:proc-macro-srv, r=lnicola
Drop support for non-syroot proc macro ABIs

This makes some bigger changes to how we handle the proc-macro-srv things, for one it is now an empty crate if built without the `sysroot-abi` feature, this simplifies some things dropping the need to put the feature cfg in various places. The cli wrapper now actually depends on the server, instead of being part of the server that is just exported, that way we can have a true dummy server that just errors on each request if no sysroot support was specified.
2023-04-06 08:04:55 +00:00
bors
ea22d245b6 Auto merge of #14499 - DropDemBits:drive-by-fixmes, r=Veykril
minor: Fix some simple FIXMEs

Each FIXME fix has been split into its own commit, since they're all pretty independent changes.

(Forgot to open a PR for this a few days ago, oops)
2023-04-05 20:42:55 +00:00
bors
ec803031fd Auto merge of #14494 - lowr:patch/regression-test-for-10989, r=HKalbasi
Add regression test for #10989

#10989 seems to have been fixed. This patch merely adds a regression test.

Closes #10989
2023-04-05 20:29:19 +00:00
Ryo Yoshida
0a2d0b15a1
Add regression test for #10989 2023-04-06 03:39:59 +09:00
bors
e8bad53d63 Auto merge of #14455 - jplatte:convert-nested-function-to-closure, r=Veykril
Convert nested function to closure assist

Continuation of / closes #13467.
Resolves #13230.

r? `@Veykril`
2023-04-05 17:28:46 +00:00
Jonas Platte
bc704e127d
Address another round of review comments 2023-04-05 18:48:21 +02:00
bors
da9c0bd0a7 Auto merge of #14442 - DropDemBits:structured-snippet-api, r=Veykril
internal: Implement Structured API for snippets

Fixes #11638 (including moving the cursor before the generated type parameter)

Adds `add_tabstop_{before,after}` for inserting tabstop snippets before & after nodes, and `add_placeholder_snippet` for wrapping nodes inside placeholder nodes.

Currently, the snippets are inserted into the syntax tree in `SourceChange::commit` so that snippet bits won't interfere with syntax lookups before completing a `SourceChange`.

It would be preferable if snippet rendering was deferred to after so that rendering can work directly with text ranges, but have left that for a future PR (it would also make it easier to finely specify which text edits have snippets in them).

Another possible snippet variation to support would be a group of placeholders (i.e. placeholders with the same tabstop number) so that a generated item and its uses can be renamed right as it's generated, which is something that is technically supported by the current snippet hack in VSCode, though it's not clear if that's a thing that is officially supported.
2023-04-05 14:33:30 +00:00
bors
25124a84de Auto merge of #14490 - Veykril:crategraph-dedup, r=Veykril
internal: Switch crate graph to use an Arena instead of a hashmap
2023-04-05 14:12:11 +00:00
bors
a1ca52e2a9 Auto merge of #14486 - HKalbasi:dev, r=Veykril
Desugar async fn completely

fix #14479
2023-04-05 13:58:38 +00:00
bors
265f83031f Auto merge of #14433 - hecatia-elegua:alias-based-completion, r=Veykril
Add doc-alias based completion

Closes #14406.

I adapted the parsing code from the CfgExpr parsing code, maybe there's a better abstraction for both, or attribute parsing in general. It also includes `doc(hidden)`-parsing, which means it could replace the other function.
There are a few tests for parsing.

`process_all_names` changed the most, I added some docs there to explain what happens.

Many call sites just pass an empy vec to `add_path_resolution`'s `doc_aliases`, since either it doesn't make sense to pass anything (e.g. visibility completion) or I don't know where to get them from. Shouldn't really matter, as it will just not show aliases if the vec is empty and we can extend alias completion in these cases later.

I added two tests in `special.rs` for struct name completion (which was the main thing I wanted). I also tried function and field names, but these don't work yet. I want to add those in a follow-up PR.
2023-04-05 13:44:51 +00:00
bors
c3ed59ce1c Auto merge of #14493 - lowr:fix/ws-between-text-and-pound, r=Veykril
fix: insert whitespace between text and pound

Because `text#`, `text"..."`, and `text'...'` are [reserved syntax since Rust 2021][guide]. Note that the latter two are already handled correctly.

Fixes #14487

[guide]: https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html
2023-04-05 12:25:27 +00:00
Ryo Yoshida
0df9fb22d8
fix: insert whitespace between text and pound
`text#`, `text"..."`, and `text'...'` are reserved syntax since Rust
2021. Note that the latter two are already handled correctly.
2023-04-05 20:33:17 +09:00
bors
af30656785 Auto merge of #14436 - lowr:patch/normalize-assoc-type-in-path-expr, r=HKalbasi
Normalize associated types in paths in expressions

Part of #14393

When we resolve paths in expressions (either path expressions or paths in struct expressions), there's a need of projection normalization, which `TyLoweringContext` cannot do on its own. We've been properly applying normalization for paths in struct expressions without type anchor, but not for others:

```rust
enum E {
    S { v: i32 }
    Empty,
}

impl Foo for Bar {
    type Assoc = E;
    fn foo() {
        let _ = Self::Assoc::S { v: 42 };   // path in struct expr without type anchor; we already support this
        let _ = <Self>::Assoc::S { v: 42 }; // path in struct expr with type anchor; resolves with this PR
        let _ = Self::Assoc::Empty;         // path expr; resolves with this PR
    }
}
```

With this PR we correctly resolve the whole path, but we need some more tweaks in HIR and/or IDE layers to properly resolve a qualifier (prefix) of such paths and provide IDE features that are pointed out in #14393 to be currently broken.
2023-04-05 10:47:47 +00:00
Lukas Wirth
7f0fbf7f9d Switch crate graph to use an Arena instead of a hashmap 2023-04-05 10:32:02 +02:00
Lukas Wirth
33e649d3c1 Allow warnings in out_dirs_check 2023-04-05 10:30:27 +02:00
hkalbasi
c26b12d01c Desugar async fn completely 2023-04-04 23:07:38 +03:30
Lukas Wirth
235c909b5b Also panic on status warnings 2023-04-04 19:25:57 +02:00
Lukas Wirth
25635adc00 Show proc-macro spawn errors as status notification warnings 2023-04-04 19:24:50 +02:00
Lukas Wirth
6644fe3441 Error out slow-tests when server loading errors 2023-04-04 19:12:10 +02:00
Lukas Wirth
1d085cf03b Adjust default config for slow-tests 2023-04-04 19:02:10 +02:00
bors
a6464392c1 Auto merge of #14483 - jhgg:fix/generate-delegate-methods-autoderef, r=Veykril
assist: autoderef in generate delegate methods

fixes #14438
2023-04-04 09:35:56 +00:00
Jake Heinz
f6b0c19c56 dedupe by name 2023-04-04 06:57:02 +00:00
Jake Heinz
50b427c0d1 use crate from autoderef ty 2023-04-04 06:54:26 +00:00
Jake Heinz
94e6a6642c assist: autoderef in generate delegate methods 2023-04-04 06:50:20 +00:00
bors
e871540171 Auto merge of #14482 - Veykril:vscode-linking-popup, r=Veykril
fix: Fix relative path creation using the wrong path accessor

This should hopefully fix the other errors with paths people seem to be getting
2023-04-04 06:21:34 +00:00
Lukas Wirth
7989a94391 fix: Fix relative path creation using the wrong path accessor 2023-04-04 08:20:35 +02:00
bors
f070093462 Auto merge of #14481 - Veykril:vscode-linking-popup, r=Veykril
fix: Fix vscode project linking popup buttons being swapped

closes https://github.com/rust-lang/rust-analyzer/issues/14480
2023-04-04 05:55:57 +00:00
Lukas Wirth
4243eeeb2b fix: Fix vscode project linking popup buttons being swapped 2023-04-04 07:55:09 +02:00
hecatia-elegua
170822b018
Add note for future me or others 2023-04-02 16:03:42 +02:00
bors
236576227a Auto merge of #14468 - lowr:patch/expand-macro-bang, r=Veykril
Expand Macro Recursively: don't append "!" to non-bang macro name

When we run `Expand Macro Recursively`, we prepend a comment "Recursive expansion of foo! macro" to the expansion result. I've noticed we unconditionally render the macro name with "!" and, while super subtle, I feel a bit awkward when the macro is either a derive or attribute macro.
2023-04-02 11:36:47 +00:00
Ryo Yoshida
613e008593
Don't append "!" to non-bang macro name 2023-04-02 20:13:34 +09:00
bors
1ebac28f0d Auto merge of #14465 - tamasfe:feat/rtn-syntax, r=Veykril
Limited syntax support for return type notations (RTN)

Experimental RTN bound support was recently merged into rustc (https://github.com/rust-lang/rust/issues/109417), the goal of this PR is to allow experimentation without syntax errors everywhere.

The parsing implemented currently aligns with the state of the tracking issue, it only supports the form `T<foo(..): Bounds>`. The parser always checks for the presence of `..` to disambiguate from `Fn*()` types, this is not ideal but I didn't want to spend too much time as it is an experimental feature.
2023-04-01 16:44:11 +00:00
tamasfe
25910bcde6
chore: replace TODO comment with FIXME 2023-04-01 16:31:16 +02:00
tamasfe
0b9c0c5088
feat(syntax): RTN in bounds
Limited syntactic support for experimental return type notations.
https://github.com/rust-lang/rust/issues/109417
2023-04-01 15:26:03 +02:00
bors
1ce25f114d Auto merge of #14464 - HKalbasi:dev, r=HKalbasi
lower adjusts in simple index except the last one

fix #14463
2023-04-01 13:21:44 +00:00
hkalbasi
d7fe4e2fa8 lower adjusts in simple index except the last one 2023-04-01 16:49:32 +03:30
bors
ffb04ae32d Auto merge of #14461 - HKalbasi:dev, r=Veykril
Use async block in async fn type inference

fix #14456

At some point we should probably go further and completely desugar async fn in hir lowering.
2023-04-01 05:19:36 +00:00