Lukas Wirth
144200c821
minor: Update list of safe intrinsics
2021-12-04 00:51:50 +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
91bbc55eed
Check for derive attributes by item path, not derive
identifier
2021-11-17 20:46:57 +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
bors[bot]
b9fa37f5b4
Merge #10648
...
10648: fix: Don't discard attributed items when a proc-macro unexpectedly fails to expand r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9205
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-29 13:13:12 +00:00
Lukas Wirth
98cff6572d
Don't discard attributed items when a proc-macro unexpectedly fails to expand
2021-10-29 15:10:44 +02:00
Lukas Wirth
ebd63ec1cf
feat: Make unqualified derive attributes flyimportable
2021-10-29 14:51:26 +02:00
Lukas Wirth
54e6583f53
Add dummy impls for trace_macros
and log_syntax
2021-10-26 20:52:38 +02: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
Lukas Wirth
791a2afbf9
Don't turn local names into strings in CompletionContext
2021-10-17 10:59:06 +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
a88344152d
minor: add a test for derive macros in core
2021-10-10 16:13:45 +03:00
Aleksey Kladov
5af80d8372
internal: move derived tests to the unified macro infra
2021-10-10 16:10:35 +03:00
Aleksey Kladov
55d8be5a24
internal: consistent module naming
2021-10-10 15:44:03 +03:00
Aleksey Kladov
e5acf650d0
move tests
2021-10-10 15:30:54 +03:00
Aleksey Kladov
5f8b708aca
move tests
2021-10-10 15:28:24 +03:00
Aleksey Kladov
6a3fc84921
internal: move builtin macro tests to macro expansion suite
2021-10-10 15:17:53 +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
Aramis Razzaghipour
9583dd5725
Replace if let
with match
where appropriate
2021-10-05 09:00:21 +11:00
Jonas Schievink
cca6ee5757
Expand asm!
to format_args!
2021-10-01 12:33:18 +02:00
Jonas Schievink
b994469a13
Add const_format_args!
builtin macro, fix highlighting
2021-09-30 17:16:39 +02:00
Jonas Schievink
375a0ff785
Use itertools
2021-09-30 16:37:12 +02:00
Jonas Schievink
b8437f71b6
Less hacky assert!
expansion
2021-09-30 16:30:26 +02: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
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Jonas Schievink
b8eb63f2b2
Avoid some Arc
cloning
2021-09-24 18:57:08 +02:00
Jonas Schievink
af3d6a4b61
Include macro path in eager macro resolve error
2021-09-24 15:34:57 +02:00
bors[bot]
f1d7f98ed0
Merge #10293
...
10293: fix: Don't bail on parse errors in macro input for builtin expansion r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8158
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 22:33:42 +00:00
Lukas Wirth
e7e87fc69d
Don't bail on parse errors in macro input for builtin expansion
2021-09-20 00:33:13 +02:00
Lukas Wirth
a6dde501df
Only strip derive attributes when preparing macro input
2021-09-19 23:38:38 +02:00
Lukas Wirth
0f4463e45e
fix source_to_def trying to use attribute macro calls as containers
2021-09-14 14:42:14 +02:00
Lukas Wirth
d1e489185f
Pick smaller node ancestors first when descending at offset
2021-09-14 14:10:59 +02:00
Lukas Wirth
aa1b36dc6d
Downmap the token in attribute inputs when expanding speculatively
2021-09-14 00:04:04 +02:00
Lukas Wirth
2b907652ee
Speculatively expand attributes in completions
2021-09-13 19:30:23 +02:00
Aleksey Kladov
104cd0ce88
internal: make name consistent with usage
2021-09-06 18:34:03 +03:00
Aleksey Kladov
dbb702cfc1
internal: remove accidental code re-use
...
FragmentKind played two roles:
* entry point to the parser
* syntactic category of a macro call
These are different use-cases, and warrant different types. For example,
macro can't expand to visibility, but we have such fragment today.
This PR introduces `ExpandsTo` enum to separate this two use-cases.
I suspect we might further split `FragmentKind` into `$x:specifier` enum
specific to MBE, and a general parser entry point, but that's for
another PR!
2021-09-05 22:36:36 +03:00