bors[bot]
b9538122f2
Merge #11637
...
11637: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-06 16:56:29 +00:00
Lukas Wirth
c1f91c93b2
minor: Simplify
2022-03-06 17:56:02 +01:00
Lukas Wirth
a548958cdf
fix macro-calls always expanding to expressions in LetStmt
2022-03-05 22:04:06 +01:00
Lukas Wirth
bb47c5f56c
fix: Fix macro-calls expanding to items in if/while conditions
2022-03-05 21:58:51 +01:00
Lukas Wirth
2e124d15fb
fix: Fix expand_macro always expanding the first listed derive
2022-02-22 12:32:27 +01:00
Lukas Wirth
8db88df758
simplify and document
2022-02-22 10:45:29 +01:00
Lukas Wirth
94e59c9c56
Simplify
2022-02-22 10:20:45 +01:00
Lukas Wirth
f13c98034b
Make replace_derive_with_manual_impl work again
2022-02-22 10:20:44 +01:00
Lukas Wirth
be3168dabe
Fix expand_macro
not working for derive attributes
2022-02-22 10:20:44 +01:00
Lukas Wirth
7b89d5ede2
internal: Expand the derive attribute into a pseudo expansion
2022-02-22 10:20:40 +01:00
Lukas Wirth
1505b6a9b4
internal: Split unresolve proc-macro error out of mbe
2022-02-22 10:08:00 +01:00
Chayim Refael Friedman
13ac5c3491
Fix various IDE features
...
As a side benefit, we got `let` guard support for `move_guard` for free.
2022-02-21 08:34:35 +02:00
Lukas Wirth
035bedc28b
internal: Remove name fields from MacroCallKind
2022-02-21 00:02:10 +01:00
Lukas Wirth
fbe787ee10
internal: Wrap MacroCallKind::Attr attr_args field in an Arc
2022-02-20 22:53:04 +01:00
bors[bot]
7a17fb9c43
Merge #11444
...
11444: feat: Fix up syntax errors in attribute macro inputs to make completion work more often r=flodiebold a=flodiebold
This implements the "fix up syntax nodes" workaround mentioned in #11014 . It isn't much more than a proof of concept; I have only implemented a few cases, but it already helps quite a bit.
Some notes:
- I'm not super happy about how much the fixup procedure needs to interact with the syntax node -> token tree conversion code (e.g. needing to share the token map). This could maybe be simplified with some refactoring of that code.
- It would maybe be nice to have the fixup procedure reuse or share information with the parser, though I'm not really sure how much that would actually help.
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-02-12 12:48:46 +00:00
Lukas Wirth
1c77f36311
internal: Make ascend_call_token
iterative instead of recursive
2022-02-11 22:21:35 +01:00
Florian Diebold
63fd643d72
Various fixes
2022-02-09 16:30:10 +01:00
Florian Diebold
ecf3cff4a6
Replace expressions with errors in them
2022-02-09 11:58:52 +01:00
Florian Diebold
cff209f152
WIP: Actually fix up syntax errors in attribute macro input
2022-02-07 18:12:51 +01:00
Lukas Wirth
ec677e35d0
Simplify
2022-02-04 02:50:33 +01:00
Lukas Wirth
45ff51ba22
Make more precise range macro upmapping
2022-01-31 15:53:44 +01:00
Lukas Wirth
5fd3688018
Fix token ascension single token check being inverted
2022-01-31 13:26:09 +01:00
Lukas Wirth
cc04cfc982
Reduce allocations in attribute collection
2022-01-30 22:18:32 +01:00
Jonas Schievink
35e5c3b3f9
Fix resolution of eager macro contents
2022-01-26 18:31:07 +01:00
Lukas Wirth
f1cb5ed9b0
fix: Properly cache files in Semantics when ascending macros
2022-01-14 11:07:53 +01:00
Jonas Schievink
3dd5e273b6
Shrink diagnostic spans for errors inside macros
2022-01-08 15:40:42 +01:00
Lukas Wirth
81163b8cd4
fix: Fix attribute stripping ignoring doc comments
2022-01-07 18:51:10 +01:00
Lukas Wirth
ca4baa6e55
Use FileAstId<ast::Adt>
in nameres where appropriate instead
2022-01-07 14:20:27 +01:00
Lukas Wirth
8e084132f8
internal: Do less work in hir::Semantics
2021-12-21 13:38:58 +01:00
Lukas Wirth
0bc3003960
Document token up/down mapping
2021-11-22 17:58:36 +01:00
Lukas Wirth
64cb09ddea
Add to macro testing infra to emit token map ids
2021-11-22 16:51:09 +01:00
Lukas Wirth
b57289c4cb
Skip test/bench attr expansion in resolution instead of collection
2021-11-16 20:23:56 +01:00
Lukas Wirth
d2513deb62
fix: Reimplement mapping out of test/bench attributes for runnables
2021-11-16 11:51:24 +01:00
Lukas Wirth
5c0b895f69
Rename intern_macro -> intern_macro_call
2021-11-14 16:25:47 +01:00
Lukas Wirth
2d7f5891f7
Remove faulty logic for ascending test attributes for runnables
2021-11-11 18:47:24 +01:00
bors[bot]
726b4dd8bd
Merge #10704
...
10704: internal: Short-circuit `descend_into_macros_single` r=Veykril a=Veykril
There is no need to descend everything if all we are interested in is the first mapping.
This bring `descend_into_macros` timing in highlighting in `rust-analyzer/src/config.rs` from `154ms - descend_into_macros (2190 calls)` to `24ms - descend_into_macros (2190 calls)` since we use the single variant there(will regress once we want to highlight multiple namespaces again though).
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-05 15:06:37 +00:00
Lukas Wirth
addd93ed9a
Don't search for root nodes unnecessarily
2021-11-05 15:52:10 +01:00
Lukas Wirth
439a8194b0
Replace more Name::to_string usages with Name::to_smol_str
2021-11-04 18:12:05 +01:00
Lukas Wirth
96db0d8bdd
Add Semantics::original_ast_node for upmapping nodes out of macro files
2021-11-03 21:12:36 +01:00
Lukas Wirth
ea2a2c52fc
Don't resolve attributes to non attribute macros
2021-10-21 12:22:40 +02:00
Lukas Wirth
96fbef606a
Remove obsolete test module
2021-10-20 17:03:09 +02:00
bors[bot]
ed4b312fa7
Merge #10514
...
10514: internal: clean up code duplication r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-10-10 18:09:13 +00:00
Aleksey Kladov
d4d67406d7
internal: clean up code duplication
2021-10-10 21:08:10 +03:00
Aleksey Kladov
d28a6c36e1
minor: align code to code style
...
(mutually recursive) data type definitions shall be at the start of the
file.
2021-10-10 19:13:05 +03:00
Aleksey Kladov
634f047d90
internal: add integrated test for token censoring
2021-10-10 16:52:21 +03:00
Aleksey Kladov
55d8be5a24
internal: consistent module naming
2021-10-10 15:44:03 +03:00
Aleksey Kladov
ef1251f696
feat: report errors in macro definition
...
Reporting macro *definition* error at the macro *call site* is a rather
questionable approach, but at least we don't erase the errors
altogether!
2021-10-09 15:23:55 +03:00
Aleksey Kladov
093f99b809
internal: start new macro test suite
...
I don't like our macro tests -- they are brittle and don't inspire
confidence. I think the reason for that is that we try to unit-test
them, but that is at odds with reality, where macro expansion
fundamentally depends on name resolution.
2021-10-09 13:42:32 +03:00
Jonas Schievink
d05eae6ada
Make stringify!
prettify its input
...
This will insert whitespace if the invocation is inside another macro
2021-09-27 19:02:03 +02:00
Lukas Wirth
b6ed91a6de
Rename *Owner
traits to Has*
2021-09-27 12:54:24 +02:00