Commit Graph

553 Commits

Author SHA1 Message Date
Matthias Krüger
9452dfaac7 NFC: remove redundant clones (clippy::perf) 2021-06-03 15:32:46 +02:00
Jonas Schievink
28e3e683b2 ItemTree: make variant fields inherit the enum's visibility 2021-06-03 14:26:26 +02:00
Jonas Schievink
70e19fd1cb Add comment 2021-06-03 13:51:43 +02:00
Jonas Schievink
955064b6aa Implement #[rustc_skip_array_during_method_dispatch] 2021-06-01 21:34:08 +02:00
Jonas Schievink
41321fa71d Fall back to legacy prelude 2021-06-01 19:03:00 +02:00
Jonas Schievink
f96c1a0414 Implement per-edition preludes 2021-06-01 13:39:19 +02:00
Dawer
e7c49666be Expand fixme comments 2021-06-01 01:44:51 +05:00
Dawer
466345ca81 Clean up, more docs. 2021-06-01 00:08:27 +05:00
Dawer
678d85ca7e Implement struct ctor application 2021-06-01 00:03:46 +05:00
bors[bot]
e9a797748d
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink

This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-31 12:42:32 +00:00
Jonas Schievink
cb5454db86 Diagnose unimplemented built-in macros 2021-05-30 04:19:47 +02:00
Jonas Schievink
8c639a87bd Thread proc-macro types through the HIR 2021-05-29 20:32:57 +02:00
cynecx
54d60fdee9 hir_ty: use async ret type for inference inside async bodies 2021-05-29 18:17:45 +02:00
Jonas Schievink
55f3ca2b74 Test that ItemTree works as intended 2021-05-28 00:46:05 +02:00
Laurențiu Nicola
2268a220e4 Don't store supertraits in ItemTree 2021-05-27 16:52:30 +03:00
Jonas Schievink
33debc4065 Update salsa 2021-05-27 15:05:41 +02:00
Jonas Schievink
196cb65ead Drop ignore from doctests 2021-05-27 13:55:31 +02:00
Jonas Schievink
fe910c7bc4 Reduce memory usage a bit 2021-05-26 01:26:16 +02:00
Jonas Schievink
356dd3d909 Clean up ItemTree lowering now that it's 1:1 2021-05-26 01:09:31 +02:00
Jonas Schievink
b52df91877 Stop expanding UseTrees during ItemTree lowering 2021-05-26 01:01:58 +02:00
bors[bot]
5587d0a3e3
Merge #8973
8973: internal: move diagnostics to hir r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-05-25 20:33:21 +00:00
Aleksey Kladov
5c9f31d4c2 internal: move diagnostics to hir
The idea here is to eventually get rid of `dyn Diagnostic` and
`DiagnosticSink` infrastructure altogether, and just have a `enum
hir::Diagnostic` instead.

The problem with `dyn Diagnostic` is that it is defined in the lowest
level of the stack (hir_expand), but is used by the highest level (ide).

As a first step, we free hir_expand and hir_def from `dyn Diagnostic`
and kick the can up to `hir_ty`, as an intermediate state. The plan is
then to move DiagnosticSink similarly to the hir crate, and, as final
third step, remove its usage from the ide.

One currently unsolved problem is testing. You can notice that the test
which checks precise diagnostic ranges, unresolved_import_in_use_tree,
was moved to the ide layer. Logically, only IDE should have the infra to
render a specific range.

At the same time, the range is determined with the data produced in
hir_def and hir crates, so this layering is rather unfortunate. Working
on hir_def shouldn't require compiling `ide` for testing.
2021-05-25 17:49:59 +03:00
Lukas Wirth
28ca371755 Consider trait to be in scope for trait-impl 2021-05-25 16:16:29 +02:00
Florian Diebold
35c948ff4a Fix lowering of FnOnce() without return type
This should result in an implicit `-> ()`, not leaving out the binding.
2021-05-25 14:29:53 +02:00
Jonas Schievink
31175a7f88 internal: intern AttrInput 2021-05-25 00:50:19 +02:00
Jonas Schievink
533e9207d3 Intern GenericArgs
This shaves off another ~4 mb or so
2021-05-24 15:35:46 +02:00
Jonas Schievink
8ebb8d29e1 internal: intern TypeBounds
Doesn't save much memory (~2 mb), but interning things is generally a
good pattern to follow
2021-05-24 15:13:23 +02:00
bors[bot]
495c9586ec
Merge #8945
8945: fix: Make expected type work in more situations r=flodiebold a=flodiebold

Also makes call info show the correct types for generic methods.

![2021-05-23-182952_1134x616_scrot](https://user-images.githubusercontent.com/906069/119269023-dd5a5b00-bbf5-11eb-993a-b6e122c3b9a6.png)
![2021-05-23-183117_922x696_scrot](https://user-images.githubusercontent.com/906069/119269025-dfbcb500-bbf5-11eb-983c-fc415b8428e0.png)


Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-05-23 21:55:51 +00:00
Jonas Schievink
693325fc39 internal: document ItemTree design 2021-05-23 23:09:38 +02:00
Florian Diebold
7a0c93c58a Infer correct expected type for generic struct fields 2021-05-23 18:45:44 +02:00
Jonas Schievink
11825ac5fe Explain why nested TypeRef aren't interned 2021-05-23 16:28:23 +02:00
Jonas Schievink
15ff7faf3d Render where clauses and more generic params 2021-05-23 02:51:58 +02:00
Jonas Schievink
380293d6c2 Pretty-print generic parameters 2021-05-23 01:15:26 +02:00
Jonas Schievink
c22ccd07fe ItemTree: pretty-print all paths 2021-05-23 00:37:15 +02:00
Jonas Schievink
d077b8a7e0 Work around non-unique AttrIds 2021-05-22 02:30:03 +02:00
Jonas Schievink
8d13864440 Add an ItemTree pretty-printer 2021-05-21 23:45:27 +02:00
Jonas Schievink
01df4c04d1 impl Display for AttrInput/ImportAlias 2021-05-21 23:45:09 +02:00
Jonas Schievink
45f4a1e559 Remove StructDefKind 2021-05-21 21:08:06 +02:00
Jonas Schievink
d00bc9c2fc Don't lower extern block in the ItemTree 2021-05-21 18:27:25 +02:00
Jonas Schievink
6f19484c93 Support #[register_attr] and #[register_tool] 2021-05-20 20:40:02 +02:00
Jonas Schievink
df824c2f81 Rename ignore_attrs_on to skip_attrs 2021-05-20 20:18:53 +02:00
Jonas Schievink
9ac5a90522 Simplify 2021-05-20 20:08:39 +02:00
Jonas Schievink
036e5b2806 Refactor name resolution to resolve derive helpers 2021-05-20 19:56:04 +02:00
Jonas Schievink
f088606d89 Rename unexpanded_macros to unresolved_macros 2021-05-20 13:12:29 +02:00
Jonas Schievink
d4eb6708d9 Track in-scope derive helpers during nameres 2021-05-19 23:35:09 +02:00
Jonas Schievink
4a84c3fb21 Fix unresolved attribute fallback again 2021-05-19 22:08:34 +02:00
bors[bot]
49922cb2c3
Merge #8885 #8887
8885: internal: greatly simplify eager macro representation r=jonas-schievink a=jonas-schievink

- Share structures with lazy macros, make both use `MacroCallLoc`.
- Remove `intern_eager_expansion`, `EagerCallLoc`, `EagerMacroId`, and *many* matches on `MacroCallId`.
- Make a lot of FIXMEs obsolete since the code no longer distinguishes between eager and lazy macros.
- Add `EagerCallInfo`, which is `Some` for calls to eager macros and holds the argument or expansion result and the included file.

8887: fix: fix derive collection after unresolved attribute fallback r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/pull/8882#issuecomment-844379170

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-19 19:07:05 +00:00
Jonas Schievink
274d813cff Fix derive collection after unresolved attribute fallback 2021-05-19 21:05:58 +02:00
Jonas Schievink
ea8555b155 Simplify eager macro representation 2021-05-19 20:19:08 +02:00
bors[bot]
1cf0794f5e
Merge #8882
8882: internal: resolve attributes in name resolution (minimal version) r=jonas-schievink a=jonas-schievink

Closes https://github.com/rust-analyzer/rust-analyzer/pull/7049

This should not have any observable effect, since we don't attempt to expand attribute macros yet, and I have implemented a fallback that treats items with unresolved attributes as if the attribute wasn't there.

Derive helpers are not yet resolved. `#![register_{attr,tool}]` are not yet supported.

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-05-19 17:06:49 +00:00