Commit Graph

350 Commits

Author SHA1 Message Date
bors
9b54e39762 Auto merge of #14587 - Veykril:macro-def-err, r=Veykril
fix: Bring back LRU limit for macro_expand query

Should fix the memory increase
2023-04-16 19:30:42 +00:00
Lukas Wirth
76718ea2fc Bring back LRU limit for macro_expand query 2023-04-16 21:30:04 +02:00
bors
924d30a772 Auto merge of #14585 - Veykril:macro-def-err, r=Veykril
Make `ExpandDatabase::parse_macro_expansion` and `ExpandDatabase::parse_or_expand` infallible
2023-04-16 18:50:02 +00:00
Lukas Wirth
4ea5d7f6a0 Re-introduce option for macro_arg to prevent calling macros with empty inputs 2023-04-16 20:26:26 +02:00
bors
697b335fda Auto merge of #14584 - Veykril:macro-def-err, r=Veykril
internal: Report item-level macro expansion syntax errors
2023-04-16 17:40:20 +00:00
Lukas Wirth
a2a3fecae3 Option begone part 2 2023-04-16 19:20:48 +02:00
Lukas Wirth
96a774261f Option begone part 1 2023-04-16 19:20:42 +02:00
Lukas Wirth
0f4ffaa5af Fix duplicate eager expansion errors 2023-04-16 19:20:35 +02:00
Lukas Wirth
d1632c2727 Report syntax errors from item level macro expansions 2023-04-16 17:22:06 +02:00
Lukas Wirth
6ae8d49e15 Simplify eager macro error handling 2023-04-16 15:46:12 +02:00
bors
f0a40c3a0e Auto merge of #14583 - Veykril:macro-def-err, r=Veykril
internal: Report macro definition errors on the definition

We still report them on the call site as well for the time being, and the diagnostic doesn't know where the error in the definition comes from, but that can be done later on
2023-04-16 12:17:24 +00:00
Lukas Wirth
a5558cdfe5 internal: Report macro definition errors on the definition 2023-04-16 14:15:59 +02:00
bors
c0889589d1 Auto merge of #14581 - Veykril:layout-ty, r=Veykril
internal: Move layout logic from hir-def to hir-ty
2023-04-16 10:22:24 +00:00
Lukas Wirth
0bb9a17312 internal: Move layout logic from hir-def to hir-ty 2023-04-16 12:21:12 +02:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern 2023-04-16 04:28:29 +09:00
bors
96407424de Auto merge of #14574 - Veykril:blocks, r=Veykril
internal: Make block_def_map infallible
2023-04-14 11:48:33 +00:00
Lukas Wirth
c32d51979d internal: Make block_def_map infallible 2023-04-14 13:17:38 +02:00
bors
4667379f7e Auto merge of #14575 - Veykril:attrs, r=Veykril
internal: Put Attrs behind a query instead of AttsWithOwner

We call this for pretty much every item, so this is unnecessary wasted memory
2023-04-14 11:17:18 +00:00
Lukas Wirth
ed3a5eac3c internal: Put Attrs behind a query instead of AttsWithOwner 2023-04-14 12:47:33 +02:00
Lukas Wirth
ce0896b78c Allocate ExprScopes ScopeEntries in a single arena instead of per ScopeData 2023-04-14 12:05:11 +02:00
bors
7afd2048f0 Auto merge of #14544 - HKalbasi:dev, r=Veykril
Infer types of nested RPITs

fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
2023-04-11 14:49:04 +00:00
Ryo Yoshida
0ce71dd76f
completion: check stability 2023-04-11 21:21:13 +09:00
hkalbasi
a584cb998f Infer types of nested RPITs 2023-04-11 04:32:11 +03:30
hkalbasi
59b6f2d9f2 Compute closure captures 2023-04-10 23:04:34 +03:30
hkalbasi
c54cb88950 Add bounds for associated types in derive macro 2023-04-07 19:33:14 +03:30
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
hkalbasi
0241b52dad Add bounds for fields in derive macro 2023-04-07 02:21:46 +03:30
Lukas Wirth
f742943a4b Don't recreate Hygiene unnecessarily 2023-04-06 21:16:11 +02: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
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
Lukas Wirth
0e7117900c internal: Resolve labels in body lowering 2023-04-06 14:21:20 +02: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
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
hkalbasi
c26b12d01c Desugar async fn completely 2023-04-04 23:07:38 +03:30
hecatia-elegua
170822b018
Add note for future me or others 2023-04-02 16:03:42 +02: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
hkalbasi
8a6ca86247 Use async block in async fn type inference 2023-04-01 04:35:28 +03:30