Lukas Wirth
2b907652ee
Speculatively expand attributes in completions
2021-09-13 19:30:23 +02: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
Aleksey Kladov
51b955ec8a
internal: simplify
2021-08-31 15:09:46 +03:00
Dezhi Wu
ba0947dded
switch log
crate to tracing
2021-08-30 15:11:42 +08:00
Lukas Wirth
c5059e0623
Return all ranges corresponding to a token id in TokenMap
2021-08-29 00:49:57 +02:00
bors[bot]
fae440c32a
Merge #10025
...
10025: Don't mutate syntax trees when preparing proc-macro input r=Veykril a=Veykril
Fixes #10013
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-28 14:14:54 +00:00
Lukas Wirth
d6134b6802
Don't mutate syntax trees when preparing proc-macro input
2021-08-25 18:57:24 +02:00
Lukas Wirth
4933beca87
Respect attributes in Hygiene token up-mapping
2021-08-22 19:12:45 +02:00
Lukas Wirth
5fb8c0ddfd
Remove MappedSubtree
2021-08-21 18:19:18 +02:00
Lukas Wirth
177c70128c
Map attribute input tokens correctly
2021-08-21 18:13:41 +02:00
Aleksey Kladov
1850849325
internal: prep to 2021 edition
2021-08-20 16:20:18 +03:00
Lukas Wirth
557df6ff3f
Use correct HirFileId in find_related_test
2021-08-20 13:50:40 +02:00
Lukas Wirth
7342dcf0b0
Fix runnables not seeing test and bench attributes
2021-08-20 13:50:06 +02:00
Lukas Wirth
c67ecbebc4
Rename fails on renaming definitions created by macros
2021-08-20 00:12:47 +02:00
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