Jonas Schievink
f8acae7895
Support let...else
2021-10-07 17:06:24 +02:00
cynecx
07cd19dcef
parser: fix parsing of macro call inside generic args
2021-10-06 22:41:35 +02:00
bors[bot]
94fa49c0a3
Merge #10420
...
10420: Parse outer attributes on StructPatternEtCetera r=jonas-schievink a=XFFXFF
Try to fix https://github.com/rust-analyzer/rust-analyzer/issues/8610
Related pr in ungrammer: https://github.com/rust-analyzer/ungrammar/pull/41
Co-authored-by: zhoufan <1247714429@qq.com>
2021-10-06 15:05:40 +00:00
bors[bot]
86c534f244
Merge #10440
...
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg
I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537 ](https://github.com/rust-lang/rust-clippy/issues/5537 ) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159 )), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.
I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.
Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P
Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00
zhoufan
a248f39cb4
make Some(1..) parsed
2021-10-04 17:33:48 +08:00
Aramis Razzaghipour
eff195852d
Fix miscellaneous Clippy lints
2021-10-03 23:53:30 +11:00
Aramis Razzaghipour
55c0b86cde
Add semicolons for consistency
...
`clippy::semicolon_if_nothing_returned`
2021-10-03 23:39:43 +11:00
zhoufan
116c7aef7f
move outer_attrs call before the match
2021-10-03 09:22:02 +08:00
Aleksey Kladov
393f80e036
minor
2021-10-02 13:20:45 +03:00
zhoufan
0ee6b70b34
Parse outer attributes on StructPatternEtCetera
2021-10-02 09:57:44 +08: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
Aleksey Kladov
56964c9bd3
feat: allow attributes on all expressions
...
Attrs are syntactically valid on any expression, even if they are not
allowed semantically everywhere yet.
2021-09-25 22:19:27 +03:00
Aleksey Kladov
6997adfee7
simplify attribute parsing
2021-09-25 18:07:51 +03:00
Aleksey Kladov
f27cda6865
minor: more condensed tests
2021-09-25 14:24:57 +03:00
Aleksey Kladov
f692be853b
minor: link my own pratt parsing article :-)
2021-09-25 14:20:34 +03:00
Aleksey Kladov
1567bbb73e
minor: more focusted tests
2021-09-25 14:04:27 +03:00
Aleksey Kladov
a6f17f7436
minor: more readable code
2021-09-25 13:27:53 +03:00
Aleksey Kladov
a6181bfdb7
internal: more focused tests for const arguments
2021-09-19 16:35:10 +03:00
Aleksey Kladov
09531b703d
minor: simplify
2021-09-19 14:50:53 +03:00
Aleksey Kladov
0005678649
minor: simplify
2021-09-19 14:26:35 +03:00
Aleksey Kladov
f99bdf4cc0
fix: don't allow two turbo-fishes in generic arguments
2021-09-19 12:09:50 +03:00
Aleksey Kladov
8009ccc27d
minor: improve readability
2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0
minor: reduce duplication
2021-09-19 11:19:31 +03:00
Aleksey Kladov
fbb6a6a95b
fix: correctly handle jointness
2021-09-18 16:09:12 +03:00
Aleksey Kladov
c0556bd8c1
minor: improve readability
2021-09-18 15:56:26 +03:00
Aleksey Kladov
ed84717869
internal: better naming
2021-09-18 15:55:07 +03:00
Aleksey Kladov
3dc2aeea0f
internal: parser cleanup
2021-09-18 15:46:28 +03:00
Aleksey Kladov
af9fd37cd9
internal: minimize use_tree parser tests
...
The code here is intentionally dense and does exactly what is written.
Explaining semantic difference between Rust 2015 and 2018 doesn't help
with understanding syntax. Better to just add more targeted tests.
2021-09-18 15:22:49 +03:00
Aleksey Kladov
1d2e9818d6
internal: parser cleanups
2021-09-18 14:53:46 +03:00
Aleksey Kladov
aaadaa40bd
internal: more focused trait item parsing tests
2021-09-18 14:34:29 +03:00
Aleksey Kladov
3474e3b3b1
intenral: more local tests for statics
2021-09-18 01:02:43 +03:00
Aleksey Kladov
1feb8e89d5
minor: cleanup const parsing
2021-09-18 00:58:35 +03:00
Aleksey Kladov
46326b8db7
minor: better test placement
2021-09-18 00:54:03 +03:00
Aleksey Kladov
2195ecd7e7
internal: cleanup adt parsing
2021-09-18 00:50:27 +03:00
Aleksey Kladov
d890c767c4
internal: cleanup item parsing
2021-09-18 00:33:42 +03:00
Aleksey Kladov
ec2043a082
minor: parser cleanup
2021-09-18 00:14:20 +03:00
Aleksey Kladov
329b01ca67
minor: simplify
2021-09-17 22:26:39 +03:00
Aleksey Kladov
77e8421d0f
internal: more local parsing tests for macros
2021-09-17 22:21:57 +03:00
Aleksey Kladov
073d5f7733
internal: more focused parsing tests
2021-09-17 22:15:12 +03:00
Aleksey Kladov
55078c81e0
internal: more local test for mod item
2021-09-17 21:53:24 +03:00
Aleksey Kladov
715cd8d938
internal: more local parsing tests
2021-09-17 21:49:01 +03:00
Aleksey Kladov
f632b5e481
internal: parser cleanups
2021-09-17 21:40:28 +03:00
Aleksey Kladov
c56f041477
internal: simplify
2021-09-13 13:35:31 +03:00
Aleksey Kladov
940b3afd00
internal: fix bugs in tests by simplifying code
2021-09-13 13:29:27 +03:00
Aleksey Kladov
4452f9ec48
internal: improve style
...
Group related stuff together, use only on path for parsing extern blocks
(they actually have modifiers).
Perhaps we should get rid of items_without_modifiers altogether? Better
to handle these kinds on diagnostics in validation layer...
2021-08-30 15:55:40 +03:00
Aleksey Kladov
8dc3b46017
fix: avoid panic when parsing extern block
...
closes #10083
2021-08-30 15:40:47 +03:00
Jonas Schievink
d568e7686a
Support if let
match guards
2021-08-13 00:25:14 +02:00
Jade
775670e32c
Split the test
2021-08-04 03:01:48 -07:00
Jade
b90ed92a5c
Support exclusive_range_pattern
...
Fix #9779
2021-08-03 21:36:29 -07:00
Lukas Wirth
f04cff102f
Simplify
2021-07-30 13:12:52 +02:00
Lukas Wirth
4de447b293
Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST
2021-07-29 23:02:52 +02:00
Lukas Wirth
f43cd562bc
Fix generic_arg not parsing opt_generic_arg_list properly in arg lists
2021-07-26 15:21:19 +02:00
Lukas Wirth
dfdf6fd9f8
Fix some more basic clippy lints
2021-07-21 20:52:08 +02:00
bors[bot]
ea105f9396
Merge #9619
...
9619: Support GATs for associated type arg parsing r=Veykril a=Veykril
Fixes #9602
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-18 09:10:56 +00:00
Lukas Wirth
e7aa37c20a
Support GATs for associated type arg parsing
2021-07-18 11:08:43 +02:00
Aleksey Kladov
15f11dce4a
feat: improve parser error recovery for function parameters
2021-07-17 22:41:04 +03:00
Lukas Wirth
c1bf1f88ad
Complete repr
attribute parameters
2021-06-17 21:15:49 +02:00
bors[bot]
5a8ddb4b2d
Merge #9260
...
9260: tree-wide: make rustdoc links spiky so they are clickable r=matklad a=lf-
Rustdoc was complaining about these while I was running with --document-private-items and I figure they should be fixed.
Co-authored-by: Jade <software@lfcode.ca>
2021-06-14 07:16:48 +00:00
Jade
20b325c7d5
tree-wide: make rustdoc links spiky so they are clickable
2021-06-13 21:58:05 -07:00
Jonas Schievink
1d6eef1350
Update ungrammar
2021-06-11 18:34:30 +02:00
Clemens Wasser
3c6dc0f89d
Apply a few clippy suggestions
2021-06-03 11:46:03 +02:00
Aleksey Kladov
dc1577d58d
Add even more docs
2021-05-22 17:20:22 +03:00
Lukas Wirth
174f043c8d
Add =
to pattern recovery
2021-05-08 23:14:08 +02:00
Jonas Schievink
cb8632d87c
Parse const param defaults
2021-04-29 03:07:53 +02:00
Jonas Schievink
caee3a2eeb
Correctly parse negated literals as const args
2021-04-29 02:27:55 +02:00
Lukas Wirth
3f7a086b4f
Parse outer atttributes for RecordPatField
2021-04-21 11:08:15 +02:00
cynecx
cf3b4f1e20
hir_ty: Expand macros at type position
2021-04-17 16:24:56 +02:00
Edwin Cheng
c4173bb468
Handle extended key value attr in mbe
2021-04-17 14:31:52 +08:00
Lukas Wirth
4771a56791
Parse extended_key_value_attributes
2021-03-19 02:13:46 +01:00
Jonas Schievink
022a0f061e
Correctly parse attributes on fn parameters
2021-03-17 18:28:27 +01:00
Edwin Cheng
8e07b23b84
Fix macro expansion for statements w/o semicolon
2021-03-16 13:44:50 +08:00
Arnaud
95d239da99
Specialization for async traits
2021-02-15 18:33:12 +01:00
Jonas Schievink
70f388cedb
Pin Rust to 1.49.0 on CI
2021-02-12 13:05:56 +01:00
Lukas Wirth
70d43c3faf
Add validation for mutable const items
2021-01-24 02:17:41 +01:00
Lukas Wirth
b26002410b
Parse impl const Trait
2021-01-18 20:18:02 +01:00
Lukas Wirth
98718e0544
Wrap remaining self/super/crate in Name{Ref}
2021-01-15 22:18:43 +01:00
Lukas Wirth
cb863390f2
Handle self/super/crate in PathSegment as NameRef
2021-01-15 19:21:23 +01:00
Daiki Ihara
85cd3524e2
Add support for yiled keyword
2021-01-15 23:35:17 +09:00
bors[bot]
607b9ea160
Merge #7218
...
7218: Fix typos r=Veykril a=regexident
Apart from the very last commit on this PR (which fixes a public type's name) all changes are non-breaking.
Co-authored-by: Vincent Esche <regexident@gmail.com>
2021-01-10 18:16:29 +00:00
Lukas Wirth
e618d12903
Replace SyntaxKind usage with T! macro where applicable
2021-01-10 17:14:01 +01:00
Laurențiu Nicola
a7db8abab7
Use T! for bool keywords
2021-01-10 17:47:12 +02:00
Callym
dcb4c0ada6
Allow true
and false
keywords in const generics
2021-01-10 13:58:09 +00:00
Vincent Esche
21f8239ac8
Fixed typos in code comments
2021-01-09 15:41:29 +01:00
Lukas Wirth
3e0bb89541
Fix macro_rules not accepting brackets or parentheses
2020-12-24 09:36:47 +01:00
Lukas Wirth
bdd8c0b68f
Remove local ungrammar dependency
2020-12-23 11:22:36 +01:00
Lukas Wirth
2c94c4964a
Parse const effect block
2020-12-23 02:15:44 +01:00
Lukas Wirth
03a9bbacf2
Parse ConstBlockPat
2020-12-23 01:49:43 +01:00
bors[bot]
9bb9fbab3a
Merge #6965
...
6965: Properly attach attributes to Param instead of parent ParamList r=matklad a=Veykril
Fixes #2783 , fixes #2781
The problem with `let _a = [0,#[cfg(feature = "L")]0];` has already been fixed some time ago it seems:
<details>
<summary>Syntax Tree for the const item</summary>
```
LET_STMT@200..236
LET_KW@200..203 "let"
WHITESPACE@203..204 " "
IDENT_PAT@204..206
NAME@204..206
IDENT@204..206 "_a"
WHITESPACE@206..207 " "
EQ@207..208 "="
WHITESPACE@208..209 " "
ARRAY_EXPR@209..235
L_BRACK@209..210 "["
LITERAL@210..211
INT_NUMBER@210..211 "0"
COMMA@211..212 ","
LITERAL@212..234
ATTR@212..233
POUND@212..213 "#"
L_BRACK@213..214 "["
PATH@214..217
PATH_SEGMENT@214..217
NAME_REF@214..217
IDENT@214..217 "cfg"
TOKEN_TREE@217..232
L_PAREN@217..218 "("
IDENT@218..225 "feature"
WHITESPACE@225..226 " "
EQ@226..227 "="
WHITESPACE@227..228 " "
STRING@228..231 "\"L\""
R_PAREN@231..232 ")"
R_BRACK@232..233 "]"
INT_NUMBER@233..234 "0"
R_BRACK@234..235 "]"
SEMICOLON@235..236 ";"
```
</details>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-12-21 08:54:31 +00:00
Lukas Wirth
3ea4d43850
Properly parse legacy trait objects with leading ForType
2020-12-20 21:53:55 +01:00
Lukas Wirth
64caa027b8
Parse attributes in tuple expressions
2020-12-20 21:01:36 +01:00
Lukas Wirth
4be9ed675e
Properly attach attributes to Param instead of parent ParamList
2020-12-20 20:30:18 +01:00
Lukas Wirth
dd496223f5
Node-ify lifetimes
2020-12-16 14:16:09 +01:00
Jonas Schievink
c1cb595382
Move to upstream macro_rules!
model
2020-12-15 15:37:37 +01:00
David Tolnay
8a11da40a7
Parse unsafe extern block
2020-11-22 20:44:56 -08:00
Aleksey Kladov
5ba4f949c2
Kill RAW_ literals
...
Syntactically, they are indistinguishable from non-raw versions, so it
doesn't make sense to separate then *at the syntax* level.
2020-11-06 22:23:14 +01:00
Pavan Kumar Sunkara
4d97f5f037
Rename record_field_pat to record_pat_field
2020-09-10 18:56:04 +02:00
Aleksey Kladov
4b989009e3
CONST LOOPS ARE HERE
2020-08-27 18:12:01 +02:00
Aleksey Kladov
18b667cfcb
Complete pub
in fields
2020-08-25 17:22:23 +02:00
Aleksey Kladov
ef462ed6af
Better recovery in use foo::;
2020-08-13 18:50:21 +02:00
Aleksey Kladov
6bc2633c90
Align parser names with grammar
2020-08-13 17:59:27 +02:00
Aleksey Kladov
50a02eb359
Rename ra_parser -> parser
2020-08-12 17:14:23 +02:00