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
Gaxx
fa7a91844a
Try to update parser doc
2023-11-08 16:29:21 -08:00
Laurențiu Nicola
d1d111d09e
Merge commit '3b7c7f97e4a7bb253a8d398ee4f8346f6cf2817b' into sync-from-ra
2023-11-08 08:15:03 +02:00
bohan
d20471334f
use visibility to check unused imports and delete some stmts
2023-10-22 21:27:46 +08:00
Pol Valletbó
6845c80a2f
fix: format
2023-10-11 15:52:22 +02:00
Pol Valletbó
4b281ffdf2
chore: format imports
2023-10-11 15:52:05 +02:00
Pol Valletbó
b769f34f63
chore: move common code to function
2023-10-11 15:45:45 +02:00
Pol Valletbó
e1aeb7fa79
fix: handle errors for string byte string and c_string
2023-10-11 15:25:52 +02:00
Pol Valletbó
677e6f3439
fix: use unescape_byte function for Byte literals
2023-10-11 13:09:15 +02:00
Pol Valletbó
f58a8250dc
fix: cargo fmt
2023-10-11 12:36:53 +02:00
Pol Valletbó
1fe6ac87e9
add diagnosis messages for chars and byte literal errors
2023-10-11 12:19:00 +02:00
Lukas Wirth
a382e649ca
Recover better on missing parameter in param list
2023-09-29 12:50:16 +02:00
bors
11ffcc08a3
Auto merge of #15615 - shogo-nakano-desu:refactor/fix-clippy-lints, r=Veykril
...
Refactor/fix clippy lints
As title says.
2023-09-22 06:46:29 +00:00
Laurențiu Nicola
bcfc997eac
Merge commit '258b15c506a2d3ad862fd17ae24eaf272443f477' into sync-from-ra
2023-09-18 12:33:49 +03:00
hkalbasi
f4704bc8ae
Switch to in-tree rustc dependencies with a cfg flag
2023-09-15 18:10:11 +03:30
shogo-nakano-desu
ebbbaaa90f
refactor: fix clippy lints
2023-09-15 16:43:21 +09:00
Lukas Wirth
3fa0bf0dd3
Fix ide-diagnostics test fixture
2023-09-06 18:31:16 +02:00
Lukas Wirth
abe8f1ece4
Implement builtin#format_args, using rustc's format_args parser
2023-09-05 19:19:46 +02:00
Lukas Wirth
3431d586e5
Insert builtin#asm into asm! expansion
2023-09-05 14:00:49 +02:00
Lukas Wirth
15048304e3
Implement offset_of in hir-def and hir-ty
2023-09-05 12:27:52 +02:00
Lukas Wirth
9b8eb807a3
Parse builtin# syntax
2023-09-05 10:36:35 +02:00
Laurențiu Nicola
30d8aa1bec
Merge commit '9b3d03408c66749d56466bb09baf2a7177deb6ce' into sync-from-ra
2023-08-21 12:44:09 +03:00
bors
b771de3fdc
Auto merge of #15179 - ponyii:fix/default-values-of-const-params-are-ignored, r=HKalbasi
...
the "add missing members" assists: implemented substitution of default values of const params
To achieve this, I've made `hir::ConstParamData` store the default values
2023-08-15 10:17:43 +00:00
Lukas Wirth
9ac88d8d36
Fix parser being stuck in eager macro inputs
2023-08-12 08:27:27 +02:00
ponyii
4ebdc6f052
syntax update: the default value of ConstParam
turned from Expr
into ConstArg
2023-08-08 21:57:54 +04:00
Lukas Wirth
cba39f8553
fix: Fix float parser hack creating empty NameRef tokens
2023-08-08 14:44:33 +02:00
Laurențiu Nicola
aa55ce9567
Merge commit 'baee6b338b0ea076cd7a9f18d47f175dd2ba0e5d' into sync-from-ra
2023-08-07 12:03:15 +03:00
Lukas Wirth
042be329a7
Turn unresolved proc macro expansions into missing expressions
2023-08-05 20:00:37 +02:00
Lukas Wirth
bcff166b3a
Add ExternCrateDecl to HIR
2023-08-02 11:52:55 +02:00
Lukas Wirth
7c765d9f9e
fix: Expand eager macros to delimited comma separated expression list
2023-07-30 17:31:26 +02:00
Laurențiu Nicola
0155385b57
Merge commit '99718d0c8bc5aadd993acdcabc1778fc7b5cc572' into sync-from-ra
2023-07-24 12:21:34 +03:00
Laurențiu Nicola
4704881b64
Merge commit '37f84c101bca43b11027f30ab0c2852f9325bc3d' into sync-from-ra
2023-07-17 16:49:15 +03:00
Ryo Yoshida
004971f3f0
Remove crate
visibility modifier
2023-07-16 00:01:11 +09:00
Ryo Yoshida
49b039f1d1
Recover from missing associated items and generic const defaults
2023-07-05 00:24:11 +09:00
Ryo Yoshida
4e793e7859
Use anonymous lifetime where possible
2023-06-29 23:27:28 +09:00
Laurențiu Nicola
9326cf7f0c
Merge commit 'cd3bf9fe51676b520c546460e6d8919b8c8ff99f' into sync-from-ra
2023-06-19 09:14:04 +03:00
hkalbasi
f8594f78bb
Use ConstArg
instead of Expr
for AstId
of InTypeConstId
2023-06-11 00:39:28 +03:30
Laurențiu Nicola
c48062fe2a
Merge commit 'aa9bc8612514d216f84eec218dfd19ab83f3598a' into sync-from-ra
2023-06-05 12:04:23 +03:00
Ryo Yoshida
f9c1a7dcd9
fix: assignment operators are right associative
2023-06-03 19:58:35 +09:00
Lukas Wirth
7d1bf7023d
Recover from leading comma in tuple pat and expr
2023-06-01 08:40:50 +02:00
bors
2df56cadcb
Auto merge of #14755 - poliorcetics:clippy-fixes, r=Veykril
...
Fix: a TODO and some clippy fixes
- fix(todo): implement IntoIterator for ArenaMap<IDX, V>
- chore: remove unused method
- fix: remove useless `return`s
- fix: various clippy lints
- fix: simplify boolean test to a single negation
2023-05-24 11:13:52 +00:00
Lukas Wirth
4b577e2bc8
Support c string literals
2023-05-18 11:06:05 +02:00
Lukas Wirth
099b5b3b15
internal: Bump rustc_lexer
2023-05-18 10:17:40 +02:00
Alexis (Poliorcetics) Bourget
5411836767
fix: simplify boolean test to a single negation
2023-05-07 09:44:07 +02:00
Alexis (Poliorcetics) Bourget
d7fdf141a4
fix: various clippy lints
2023-05-07 09:43:37 +02:00
Alexis (Poliorcetics) Bourget
900d6030e7
fix: remove useless return
s
2023-05-07 09:42:52 +02:00
Ryo Yoshida
fa2340a4df
Parse associated return type bounds
2023-05-06 20:31:11 +09:00
Ryo Yoshida
d7d8971203
Remove (..)
-style return type notation
2023-05-06 20:30:17 +09:00
Ryo Yoshida
2a509d0eb2
Parse bare dyn types with leading lifetime
2023-05-05 04:30:37 +09:00
Lukas Wirth
d1ca505525
fix: Fix pat fragment handling in 2021 edition
2023-04-24 22:21:37 +02:00
bors
2400b36a2e
Auto merge of #14577 - jsoref:spelling, r=lnicola
...
Spelling
This PR corrects misspellings identified by the [check-spelling action](https://github.com/marketplace/actions/check-spelling ).
The misspellings have been reported at https://github.com/jsoref/rust-analyzer/actions/runs/4699991040#summary-12751355796
The action reports that the changes in this PR would make it happy: https://github.com/jsoref/rust-analyzer/actions/runs/4699991284#summary-12751356293
closes #14567
2023-04-19 14:05:40 +00:00
Josh Soref
bc7d84c3ce
Spelling
...
* a rule
* access
* after
* amount
* annotations
* assignment
* assist
* associated
* attribute
* borrowed
* built-in type
* clarification
* command
* const
* constructor
* corresponding
* counterparts
* curlies
* dependencies
* deterministic
* diagnostic
* duplicates
* edge
* edited
* efficient
* elsewhere
* execution
* expression
* extensions
* extracted
* fill
* github
* helper
* heuristic
* incomplete
* indent end
* inlay
* invocation
* lifetime
* looking
* maybe
* move
* mutability
* mutable
* necessarily
* necessary
* negative
* nonexistent
* occurred
* offsets
* offsetted
* overridden
* parameters
* params
* params_and_where_preds_in_scope
* paredit
* parent
* parentheses
* prepended if
* punctuation
* receive
* receiver
* referring
* repeated
* representing
* semantically
* separately
* shouldnot
* siblings
* similar
* something's
* statement
* struct
* structure
* surprise
* the
* this
* transparent
* unimplemented
* unnamed
* unnecessary
* unneeded
* unreachable
* unterminated
* utilities
* variant
* variants
* visibility
* work around (v)
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-19 09:45:55 -04:00
Ryo Yoshida
83a93f4bd3
Parse inline const pattern in nested patterns
2023-04-16 04:28:37 +09:00
Ryo Yoshida
89a1439de3
Parse exclusive range pattern
2023-04-16 04:28:29 +09:00
tamasfe
0b9c0c5088
feat(syntax): RTN in bounds
...
Limited syntactic support for experimental return type notations.
https://github.com/rust-lang/rust/issues/109417
2023-04-01 15:26:03 +02:00
Lukas Wirth
cb546390da
fix: Recover from pub()
visibility modifier
2023-03-30 13:42:15 +02:00
Laurențiu Nicola
dbf04a5ee2
⬆️ rust-analyzer
2023-03-20 08:31:01 +02:00
Lukas Wirth
55120b3d83
Add signature help for tuple struct patterns
2023-03-15 10:17:30 +01:00
Laurențiu Nicola
b2f6fd4f96
⬆️ rust-analyzer
2023-03-13 10:42:24 +02:00
XFFXFF
6e97527eae
add is_blocklike func on BlockLike
2023-03-07 17:27:52 +08:00
XFFXFF
98990affe5
add more tests
2023-03-07 08:24:25 +08:00
XFFXFF
995aacfce8
show diagnostic for } token followed by else in let else statement
2023-03-07 08:24:25 +08:00
Ryo Yoshida
2e7d2c2d04
Parse trait alias as a distinct AST type
2023-03-04 00:23:56 +09:00
shilangyu
44e47fe408
Add check for extra path segments after an angled one
2023-02-25 16:16:49 +01:00
Laurențiu Nicola
7e711da2f0
⬆️ rust-analyzer
2023-02-20 10:14:12 +02:00
Lukas Wirth
4f6b5f41d4
Recover better for more delimited sequences
2023-02-14 13:52:15 +01:00
Laurențiu Nicola
bc45c7659a
⬆️ rust-analyzer
2023-02-13 13:55:14 +02:00
Lukas Wirth
1be24e0899
internal: Improve parser recovery a bunch
2023-02-11 20:28:36 +01:00
Lukas Wirth
4788c7a056
Bump rustc-ap-rustc_lexer
2023-02-08 11:42:14 +01:00
Lukas Wirth
a756c9ad08
Fixup comments
2023-02-07 18:08:05 +01:00
Lukas Wirth
27cd509558
fix jointess for floats not being set properly
2023-02-07 17:41:16 +01:00
Lukas Wirth
f6539b139e
fix depth check for float split step
2023-02-07 15:44:00 +01:00
Lukas Wirth
c6e7917d6e
Fix up token_tree_to_syntax_node float split handling
2023-02-07 15:21:37 +01:00
Lukas Wirth
6fa6efe90f
fix: Fix parsing of nested tuple field accesses in a cursed way
2023-02-03 17:18:48 +01:00
Lukas Wirth
dab685dd87
De-magic number parser::Output encoding
2023-02-03 11:47:33 +01:00
onestacked
872408500b
Parse const_closures syntax.
...
Enables parsing of the syntax for `#![features(const_closures)]` introduced in https://github.com/rust-lang/rust/pull/106004
2023-01-19 15:40:07 +01:00
bors
fa874627f0
Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril
...
Use workspace.dependencies to declare local dependencies
2023-01-17 10:29:27 +00:00
Lukas Wirth
bed4db3c62
Use workspace.dependencies to declare local dependencies
2023-01-17 10:52:26 +01:00
Lukas Wirth
e4858fe480
Specify authors, edition and license via workspace.package
2023-01-16 16:44:00 +01:00