Commit graph

24804 commits

Author SHA1 Message Date
bors
972f1313eb Auto merge of #14526 - rust-lang:revert-14521-dev, r=Veykril
Revert "Add bounds for fields in derive macro"

Reverts rust-lang/rust-analyzer#14521 as it introduces too many mismatches
2023-04-07 09:02:31 +00:00
Lukas Wirth
435d585d0c
Revert "Add bounds for fields in derive macro" 2023-04-07 11:01:17 +02:00
bors
bca364c3fe Auto merge of #14525 - Veykril:hir-pretty, r=Veykril
internal: Remove parameter names from function item tree
2023-04-07 07:57:58 +00:00
Lukas Wirth
79c4c4fb48 Remove parameter names from function item tree 2023-04-07 09:57:19 +02:00
bors
d73161b491 Auto merge of #14524 - Veykril:hir-pretty, r=Veykril
internal: Render function parameters in hir-def pretty printing
2023-04-07 07:34:45 +00:00
Lukas Wirth
513d4a9c9a Render function parameters in hir-def pretty printing 2023-04-07 09:34:04 +02:00
bors
937ef97bc5 Auto merge of #14521 - HKalbasi:dev, r=Veykril
Add bounds for fields in derive macro

Dependency of #14470
2023-04-07 04:45:41 +00:00
hkalbasi
0241b52dad Add bounds for fields in derive macro 2023-04-07 02:21:46 +03:30
bors
e739c999cd Auto merge of #14511 - HKalbasi:dev, r=Veykril
Always reborrow mutable reference receiver in methods

Dependency of #14470
2023-04-06 21:18:15 +00:00
hkalbasi
7ba93cb8cf Always reborrow reference receiver in methods 2023-04-07 00:32:28 +03:30
bors
ca0f6bbf2f Auto merge of #14520 - lowr:fix/unify-variable-fallout, r=Veykril
fix: unify types in `infer_expr_coerce_never()`

Fixes #14506

#14506 turned out to be a regression in type inference. `infer_expr_coerce_never()` added in #14251 allows never-to-any coercion but should also perform ordinary type unification in other cases.
2023-04-06 21:02:15 +00:00
Ryo Yoshida
5ab4e64a4c
fix: unify types in infer_expr_coerce_never() 2023-04-07 05:46:30 +09:00
bors
625a6f37de Auto merge of #14519 - Veykril:hir-def-refac, r=Veykril
internal: Don't recreate Hygiene unnecessarily
2023-04-06 19:19:19 +00:00
Lukas Wirth
f742943a4b Don't recreate Hygiene unnecessarily 2023-04-06 21:16:11 +02:00
bors
a1e8535f44 Auto merge of #14518 - Veykril:hir-def-refac, r=Veykril
internal: Remove unnecessary Names from FunctionData::params
2023-04-06 18:20:32 +00:00
Lukas Wirth
b7c443569a Don't unnecessarily query the ast_id_map for blocks if they aren't interned 2023-04-06 20:19:59 +02:00
Lukas Wirth
a1b96b1e00 Remove unnecessary Names from FunctionData::params 2023-04-06 20:14:51 +02:00
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