Commit graph

268 commits

Author SHA1 Message Date
Ryo Yoshida
e027ac0fbf
fix: don't let mbe expr fragments match let exprs and inline consts 2022-12-20 20:31:47 +09:00
bors
6f313cef8e Auto merge of #13548 - lowr:fix/tt-punct-spacing, r=Veykril
Fix `tt::Punct`'s spacing calculation

Fixes #13499

We currently set a `tt::Punct`'s spacing to `Spacing::Joint` unless its next token is a trivia (i.e. whitespaces or comment). As I understand it, rustc only [sets `Spacing::Joint` if the next token is an operator](5b3e909075/compiler/rustc_parse/src/lexer/tokentrees.rs (L77-L78)) and we should follow it to guarantee the consistent behavior of proc macros.
2022-11-11 12:19:30 +00:00
Lukas Wirth
ffd7bf8bf9 Bump Cargo rust-version fields to latest stable 2022-11-07 12:59:51 +01:00
Ryo Yoshida
41b0c54c07
Fix tt::Punct's spacing calculation 2022-11-05 19:42:09 +09:00
Ryo Yoshida
b87a23b91b
Rename convertor -> converter 2022-11-05 19:41:08 +09:00
bors
855cd5c280 Auto merge of #13418 - lnicola:bump-deps, r=lnicola
Bump deps
2022-10-15 11:27:12 +00:00
Laurențiu Nicola
50f990c46f Bump smallvec 2022-10-15 12:52:34 +03:00
Lukas Wirth
78f33c0e96 Expand unmatched mbe fragments to reasonable default token trees
Currently we expand unmatched fragments by not replacing them at all,
leaving us with `$ident`. This trips up the parser or subsequent macro
calls. Instead it makes more sense to replace these with some reasonable
default depending on the fragment kind which should make more recursive
macro calls work better for completions.
2022-10-10 14:27:05 +02:00
Jonas Platte
c4a87ee0ce
mbe: Remove unneeded unwrap 2022-09-14 23:49:08 +02:00
Jonas Platte
d6f0fd04ee
mbe: Remove unnecessary reference to usize 2022-09-14 23:42:11 +02:00
Jonas Platte
54305545a5
mbe: Remove Vec reference in container 2022-09-14 23:35:12 +02:00
Jonas Platte
b6aed7914d
mbe: Remove double reference in container 2022-09-14 23:30:44 +02:00
Jonas Platte
f7f6d2870f
mbe: Use extend instead of push in loop 2022-09-14 23:26:24 +02:00
Jonas Platte
5e2f9e322f
mbe: Return Bindings from build_inner 2022-09-14 23:22:38 +02:00
Dezhi Wu
23747419ca fix: a bunch of typos
This PR will fix some typos detected by [typos].

There are also some other typos in the function names, variable names, and file
names, which I leave as they are. I'm more certain that typos in comments
should be fixed.

[typos]: https://github.com/crate-ci/typos
2022-08-17 21:44:58 +08:00
Edwin Cheng
23e17cd581 Improve insert whitespace in mbe 2022-08-10 16:28:56 +08:00
Amos Wenger
816f7fe12a Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094 Enable extra warnings required by rust-lang/rust 2022-07-20 15:00:17 +02:00
Florian Diebold
0a4065d12d Improve syntax fixup a bit, handle incomplete if
- allow appending tokens after a token, not just a node
- allow inserting delimiters (and remove them again)
- fix up `if {}` and `if` without anything following
2022-07-16 13:03:32 +02:00
Jonas Schievink
df66eb74ab Implement ignore and index metavar expression 2022-07-11 18:31:42 +02:00
Laurențiu Nicola
791f2a0bec Bump smallvec 2022-07-03 10:09:35 +03:00
Lukas Wirth
76ae5434fa internal: Bump Dependencies 2022-06-10 17:30:02 +02:00
Tim Neumann
40bfb29e50 feat: Support $$ in macros.
The implementation mirrors what `rustc` currently does [1]. Part of #11952.

[1]: 0595ea1d12/compiler/rustc_expand/src/mbe/quoted.rs (L230-L241)
2022-06-02 21:48:28 +02:00
Jonas Schievink
9bd11459ba Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
This reverts commit cc9ae2b89e, reversing
changes made to 7dfd1cb572.
2022-05-13 15:08:14 +02:00
Jonas Schievink
2287ae22c6 Revert "Skip only the tt::Literal when consuming float tokens"
This reverts commit 7db55313a1.
2022-05-13 15:06:16 +02:00
Jonas Schievink
bde036b74e Revert "Fix conversion of float literals in TtTreeSink"
This reverts commit 43a066c5a8.
2022-05-13 15:05:34 +02:00
Jonas Schievink
73e0e17b52 Revert "Don't remap float tokens to INT_NUMBER"
This reverts commit cb5e8da88a.
2022-05-13 15:04:36 +02:00
Jonas Schievink
cb5e8da88a Don't remap float tokens to INT_NUMBER 2022-05-12 19:01:09 +02:00
Jonas Schievink
43a066c5a8 Fix conversion of float literals in TtTreeSink 2022-05-06 18:39:06 +02:00
Jonas Schievink
7db55313a1 Skip only the tt::Literal when consuming float tokens 2022-05-06 16:10:54 +02:00
Jonas Schievink
37443eb9a1 Maybe everything else *should* have to deal with it 2022-05-05 16:28:59 +02:00
Jonas Schievink
1bc3305d95 Split float literal tokens at the . 2022-05-05 16:28:58 +02:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
Chayim Refael Friedman
10d30be331 Do not consider _ to be an expression for macro_rules! 2022-03-02 01:51:25 +00:00
Lukas Wirth
1505b6a9b4 internal: Split unresolve proc-macro error out of mbe 2022-02-22 10:08:00 +01:00
bellau
ff4024eebd Impr mbe: remove unecessary temporary vec 2022-02-15 10:21:14 +01:00
Florian Diebold
dfd2cef0d0 Add back an assertion 2022-02-09 16:36:45 +01:00
Florian Diebold
63fd643d72 Various fixes 2022-02-09 16:30:10 +01:00
Florian Diebold
bdb7ae5dd0 Rename syntax_node_to_token_tree_censored 2022-02-09 13:45:31 +01:00
Florian Diebold
ecf3cff4a6 Replace expressions with errors in them 2022-02-09 11:58:52 +01:00
Florian Diebold
1a5aa84e9f Track synthetic tokens, to be able to remove them again later 2022-02-08 18:13:18 +01:00
Florian Diebold
c3601e9860 Reverse fixups 2022-02-07 19:53:39 +01:00
Florian Diebold
86b968ba94 Add a check 2022-02-07 18:19:00 +01:00
Florian Diebold
b9c5d23f69 Simplify a bit 2022-02-07 18:17:28 +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
2ad71f1350 Shrink mbe::ExpandError and mbe::ParseError 2022-02-03 17:25:24 +01:00
Jonas Schievink
5088926ec3 Make syntax bridge fully infallible 2022-01-24 17:27:39 +01:00
Aleksey Kladov
303814189a simplify 2022-01-03 16:27:16 +03:00