Commit graph

399 commits

Author SHA1 Message Date
bors
2397e7a887 Auto merge of #16787 - pksunkara:remove-macro-call-check, r=lnicola
Remove unncessary check for macro call

Since `macro_rules` is a contextual keyword, it is an `IDENT` token and thus `is_path_start` already identifies it correctly. You can tell the previous check is unnecessary because the relevant tests still pass.
2024-03-08 13:23:31 +00:00
bors
2b7b44bf27 Auto merge of #16786 - pksunkara:improve-readability, r=lnicola
internal: Improve readability of the parser code

The code is basically equivalent to the previous version, but it improves the readability by making it much more simpler and concise.
2024-03-08 12:21:18 +00:00
Pavan Kumar Sunkara
a838e44032 Remove unncessary check for macro call 2024-03-08 12:03:35 +00:00
Pavan Kumar Sunkara
2a41b2cd94 Improve readability of the parser code 2024-03-08 12:00:24 +00:00
Pavan Kumar Sunkara
b37ccfce44 Remove unused keyword from visibility recovery 2024-03-08 11:53:03 +00:00
roife
91d181feff minor: fmt and clippy 2024-03-06 23:32:40 +08:00
roife
e2daee61bc test: add test for float_split_scientific_notation 2024-03-06 22:51:22 +08:00
roife
03420c330e fix: panic when split float numbers in scientific notation 2024-03-06 22:50:50 +08:00
Lukas Wirth
4303e741de Cleanup 2024-03-04 11:10:06 +01:00
Michael Goulet
3e4deab3d8 Add support for const and async trait bounds 2024-02-16 16:00:04 +00:00
Maybe Waffle
e146139957 Add support for become expr/tail calls 2024-02-14 14:57:18 +00:00
Lukas Wirth
bf115a6064 fix: Recover from = in record pattern field 2024-02-13 18:25:40 +01:00
Lukas Wirth
ccccc299c8 fix: Recover from = in record constructor field assignment 2024-02-13 18:23:33 +01:00
Tetsuharu Ohzeki
f474bd77be parser: Fix warnings about clippy str_to_string rule 2024-02-10 01:00:40 +09:00
Lukas Wirth
974e69b0c5 Recover from missing slots in delimited parsing 2024-02-08 11:14:37 +01:00
Yutaro Ohno
e865d45904 fix: Recover from missing argument in call expressions
Previously, when parsing an argument list with a missing argument (e.g.,
`(a, , b)` in `foo(a, , b)`), the parser would stop upon an unexpected
token (at the second comma in the example), resulting in an incorrect
parse tree.

This commit improves error handling in such cases, ensuring a more
accurate parse tree is built.
2024-02-08 10:54:04 +01:00
bors
66cec4d11a Auto merge of #16470 - Veykril:clippy-disallow, r=lnicola
internal: Lint debug prints and disallowed types with clippy
2024-02-05 17:20:43 +00:00
Young-Flash
864c3d5880 test: add method_call_missing_argument_list error test 2024-02-05 17:54:09 +08:00
Young-Flash
c495e3f00f fix: emit parser error for missing argument list 2024-02-05 17:54:09 +08:00
Lukas Wirth
9e8a0fae0c Lint debug prints and disallowed types with clippy 2024-02-01 17:57:27 +01:00
Laurențiu Nicola
f43cea0878 Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-from-ra 2024-01-28 15:56:54 +02:00
Lukas Wirth
8a5829cf28 Re-order mod declarations 2024-01-27 11:02:34 +01:00
Laurențiu Nicola
b1b6e0c41a Reapply "Detect NulInCStr error earlier."
This reverts commit 0ea056552a.
2024-01-25 06:40:07 +02:00
Nicholas Nethercote
858f4aca6c Rename the unescaping functions.
`unescape_literal` becomes `unescape_unicode`, and `unescape_c_string`
becomes `unescape_mixed`. Because rfc3349 will mean that C string
literals will no longer be the only mixed utf8 literals.
2024-01-25 12:28:11 +11:00
Laurențiu Nicola
e4866b6ddb Merge commit 'a9116523604c998e7781f60d3b5a6f586e0414a9' into sync-from-ra 2024-01-21 16:53:06 +02:00
Johann Hemmann
6709eaba2a never_loop 2024-01-19 17:31:01 +01:00
Johann Hemmann
b599de193f Refactor macro_call to be consistent with other functions 2024-01-18 12:50:36 +01:00
bors
1ab8c7fd27 Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
fix: add error recovery for use_tree_list parsing

This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly.

before

![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3)

after

![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c)

close https://github.com/rust-lang/rust-analyzer/issues/16227
2024-01-18 09:52:37 +00:00
Matthias Krüger
7d4980a4d8 Rollup merge of #119172 - nnethercote:earlier-NulInCStr, r=petrochenkov
Detect `NulInCStr` error earlier.

By making it an `EscapeError` instead of a `LitError`. This makes it like the other errors produced when checking string literals contents, e.g. for invalid escape sequences or bare CR chars.

NOTE: this means these errors are issued earlier, before expansion, which changes behaviour. It will be possible to move the check back to the later point if desired. If that happens, it's likely that all the string literal contents checks will be delayed together.

One nice thing about this: the old approach had some code in `report_lit_error` to calculate the span of the nul char from a range. This code used a hardwired `+2` to account for the `c"` at the start of a C string literal, but this should have changed to a `+3` for raw C string literals to account for the `cr"`, which meant that the caret in `cr"` nul error messages was one short of where it should have been. The new approach doesn't need any of this and avoids the off-by-one error.

r? ```@fee1-dead```
2024-01-18 10:34:17 +01:00
Johann Hemmann
76c67dd229 Fix test 2024-01-17 12:49:58 +01:00
Johann Hemmann
5916da2c29 Handle macro_rules! as MACRO_CALL
It's a call of the third token is neither IDENT or TRY
2024-01-17 12:07:17 +01:00
Laurențiu Nicola
6bbd106c70 Merge commit '9d8889cdfcc3aa0302353fc988ed21ff9bc9925c' into sync-from-ra 2024-01-15 11:40:09 +02:00
Young-Flash
6033b66ce0 test: correct expected test result 2024-01-12 17:42:18 +08:00
Young-Flash
d0b310fc93 fix: add USE_TREE_LIST_FIRST_SET 2024-01-12 17:41:46 +08:00
Nicholas Nethercote
6001c50cac Detect NulInCStr error earlier.
By making it an `EscapeError` instead of a `LitError`. This makes it
like the other errors produced when checking string literals contents,
e.g. for invalid escape sequences or bare CR chars.

NOTE: this means these errors are issued earlier, before expansion,
which changes behaviour. It will be possible to move the check back to
the later point if desired. If that happens, it's likely that all the
string literal contents checks will be delayed together.

One nice thing about this: the old approach had some code in
`report_lit_error` to calculate the span of the nul char from a range.
This code used a hardwired `+2` to account for the `c"` at the start of
a C string literal, but this should have changed to a `+3` for raw C
string literals to account for the `cr"`, which meant that the caret in
`cr"` nul error messages was one short of where it should have been. The
new approach doesn't need any of this and avoids the off-by-one error.
2024-01-12 16:19:37 +11:00
Young-Flash
45eea57115 add in-comment test case for use_tree_list_err_recovery 2024-01-11 19:52:23 +08:00
Young-Flash
afe05fe1d8 fix broken test 2024-01-11 19:51:45 +08:00
Young-Flash
e6dd522761 fix: add err recovery for use_tree_list parsing 2024-01-11 19:50:35 +08:00
bors
c246ecfd55 Auto merge of #16310 - Veykril:range-access-parse, r=Veykril
fix: Fix incorrect parsing error on method call on range

Fixes https://github.com/rust-lang/rust-analyzer/issues/16289
2024-01-09 09:49:25 +00:00
Lukas Wirth
b97ab00bd4 Split out rustc_lexer from rustc_dependencies 2024-01-08 15:24:46 +01:00
Lukas Wirth
72200641c1 fix: Fix incorrect parsing error on method call on range 2024-01-08 15:09:26 +01:00
Laurențiu Nicola
932d85b529 Merge commit '426d2842c1f0e5cc5e34bb37c7ac3ee0945f9746' into sync-from-ra2 2024-01-03 11:35:07 +02:00
Tetsuharu Ohzeki
efc87092b3 Use Cargo's [workspace.lints.*] to config clippy 2023-12-29 23:51:32 +09:00
Laurențiu Nicola
f532576ac5 Merge commit '457b966b171b09a7e57acb710fbca29a4b3526f0' into sync-from-ra 2023-12-11 11:16:01 +02:00
Igor Matuszewski
a7224c998d Don't explicitly warn against semicolon_in_expressions_from_macros
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
Laurențiu Nicola
30fc9329d1 Merge commit 'e402c494b7c7d94a37c6d789a216187aaf9ccd3e' into sync-from-ra 2023-12-04 09:19:15 +02:00
Yutaro Ohno
e076192dd8 Improve error handling for top-level let statements
This commit addresses the issue of excessive and unrelated errors
generated by top-level `let` statements. Now, only a single error is
produced, indicating that `let` statements are invalid at the top level.
2023-12-01 10:37:21 +09:00
Chayim Refael Friedman
2fd19ed598 Err for comma after functional update syntax 2023-11-30 14:04:36 +02:00
Laurențiu Nicola
59f5d51852 Merge commit '141fc695dca1df7cfc3c9803972ec19bb178dcbc' into sync-from-ra 2023-11-16 22:27:35 +02:00
Laurențiu Nicola
610eafe009 Merge commit '76633199f4316b9c659d4ec0c102774d693cd940' into sync-from-rust 2023-11-15 09:45:17 +02:00