Lukas Wirth
0c0142f61a
Simplify
2021-08-16 16:12:20 +02:00
Jonas Schievink
260936d0b7
Fix detection of macro file in inactive-code diag
2021-08-04 18:02:45 +02:00
Lukas Wirth
95c8c65139
Nest all the or-patterns!
2021-06-17 17:37:14 +02:00
Jade
20b325c7d5
tree-wide: make rustdoc links spiky so they are clickable
2021-06-13 21:58:05 -07:00
Lukas Wirth
ae8d74ab2c
Implement dummy expansions for builtin attributes
2021-06-09 18:27:08 +02:00
Jonas Schievink
e5a2c6596d
Expand procedural attribute macros
2021-06-03 18:09:21 +02:00
Jonas Schievink
8c639a87bd
Thread proc-macro types through the HIR
2021-05-29 20:32:57 +02: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
Jonas Schievink
489ae7a800
Make TokenTextRange
private
2021-05-24 20:29:48 +02:00
Jonas Schievink
d4eb6708d9
Track in-scope derive helpers during nameres
2021-05-19 23:35:09 +02:00
Jonas Schievink
c0d93bc4d6
Clarify field name
2021-05-19 20:23:26 +02:00
Jonas Schievink
ea8555b155
Simplify eager macro representation
2021-05-19 20:19:08 +02:00
Jonas Schievink
bda68e2332
Strip delimiter from fn-like proc macro input
2021-05-12 00:27:16 +02:00
Jonas Schievink
8ea9d939d2
Rewrite #[derive]
removal to be based on AST
2021-05-10 22:54:17 +02:00
Jonas Schievink
a87bec5148
Move AttrId
back into hir_def
2021-05-10 16:35:06 +02:00
Jonas Schievink
9cf8d325a2
Precompute macro fragment kind
2021-05-09 01:36:06 +02:00
Aleksey Kladov
95dc8ef265
make illegal states unrepresentable
...
only declarative macros have def-site token map
2021-05-04 22:41:43 +03:00
Jonas Schievink
44b04ebe43
Revert "Rewrite #[derive]
removal to be based on AST"
...
This reverts commit 7e78aebc8f
.
2021-04-10 20:30:28 +02:00
Jonas Schievink
7e78aebc8f
Rewrite #[derive]
removal to be based on AST
2021-04-09 14:10:54 +02:00
Jonas Schievink
c0dd36fd42
Store #[derive]
attribute ID along macro invoc
2021-04-09 13:38:01 +02:00
Jonas Schievink
3fcdd1bcdf
Add AttrId
to track attribute sources
2021-04-09 13:32:03 +02:00
Jonas Schievink
86b7861612
Use named fields in MacroCallKind
2021-04-08 20:43:07 +02:00
Edwin Cheng
a193666361
Basic Support Macro 2.0
2021-03-27 13:44:54 +08:00
Yilin Chen
3bb9efb6b7
use the included file as the source of expanded include macro
...
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
2021-03-21 23:02:01 +08:00
Jonas Schievink
93aeb16eb2
Return Either
from MacroDefId::ast_id
2021-03-19 19:56:13 +01:00
Jonas Schievink
54c78c96db
Rename derive-specific APIs
2021-03-19 14:23:13 +01:00
Jonas Schievink
c05a1a6e37
Store an AstId
for procedural macros
2021-03-18 16:11:18 +01:00
Jonas Schievink
b84efbaacf
Make MacroDefId's AstId
mandatory when possible
2021-03-18 15:37:14 +01:00
Matthias Krüger
64b91393b8
remove uselessly wrapped ?s. (clippy::meedless_question_mark
...
let x = Some(3);
let y = Some(x?);
can just be:
let y = x
2021-03-17 02:19:40 +01:00
Aleksey Kladov
f5a81ec468
Upgrade rowan
...
Notably, new rowan comes with support for mutable syntax trees.
2021-03-16 16:10:49 +03:00
Aleksey Kladov
6dbba4d75d
Remove useless wrapper
2021-01-15 20:15:33 +03:00
Jonas Schievink
85cc3cfec9
Revert "Proper handling $crate and local_inner_macros"
2021-01-03 11:47:57 +01:00
Edwin Cheng
fe5340d970
Introduce HygieneFrames for proper token hyginee
2021-01-02 20:39:57 +08:00
Jonas Schievink
26f604b907
Store invocation site for eager macros
2020-12-22 15:02:03 +01:00
Jonas Schievink
b238ddd21a
Make macro def krate mandatory
...
Refactors builtin derive support to go through proper name resolution
2020-12-15 20:33:05 +01:00
Jonas Schievink
c31c3246a8
Basic support for decl macros 2.0
2020-12-15 18:43:34 +01:00
Jonas Schievink
c1cb595382
Move to upstream macro_rules!
model
2020-12-15 15:37:37 +01:00
Jonas Schievink
da5027138d
Fix logic for determining macro calls
...
I believe this currently goes back all the way to the initial
user-written call, but that seems better than the current broken
behavior.
2020-12-08 19:11:12 +01:00
Jonas Schievink
4943ef085d
Make original_range
a method on InFile<&SyntaxNode>
2020-12-08 19:01:27 +01:00
Jonas Schievink
3e6ffa5124
Fix proc macro token mapping
2020-12-03 18:38:05 +01:00
Jonas Schievink
0432aa0ed7
Publish diagnostics for macro expansion errors
2020-11-27 13:50:22 +01:00
Jonas Schievink
6a9338e979
Use ExpandResult
instead of MacroResult
...
`MacroResult` is redundant
2020-11-26 16:48:17 +01:00
Jonas Schievink
9559bce311
Rename parse_macro
to parse_macro_expansion
...
This does not parse macros, it expands a macro and parses the *result*
2020-11-24 21:57:51 +01:00
Jonas Schievink
d5e9bf80f9
hir_expand: propagate expansion errors
2020-11-24 19:00:23 +01:00
Jonas Schievink
9dc0afe854
Rename CustomDerive
to ProcMacro
...
It handles fn-like macros too, and will handle attribute macros in the
future
2020-09-18 15:37:31 +02:00
Aleksey Kladov
b7aa4898e0
Rename ra_hir_expand -> hir_expand
2020-08-13 16:29:33 +02:00