Commit graph

477 commits

Author SHA1 Message Date
Chayim Refael Friedman
02d47f3a81 Fix a case where completion was unable to expand a macro
Which caused the macros of the popular `tracing` crate to not offer completions.

The reason is rather complicated: it boils down to macro ignoring their input and completion always choosing the first expansion.
2024-12-20 13:14:59 +02:00
Chayim Refael Friedman
0b7a6f38d7 Properly handle different defaults for severity of lints
Previously all lints were assumed to be `#[warn]`, and we had a hand-coded list of `#[allow]` exceptions. Now the severity is autogenerated from rustdoc output.

Also support lints that change status between editions, and the `warnings` lint group.
2024-12-11 20:48:41 +02:00
Lukas Wirth
cddaf7485f
Merge pull request #18625 from Veykril/push-npnxwpxuzlqz
fix: Fix parser getting stuck for bad asm expressions
2024-12-06 05:11:08 +00:00
Lukas Wirth
4a24e729b0 fix: Fix parser getting stuck for bad asm expressions 2024-12-06 05:57:00 +01:00
Lukas Wirth
a049941c1a fix: Fix parsing of dyn T in generic arg on 2015 edition 2024-12-05 20:26:49 +01:00
Lukas Wirth
f3d7415bd6 Parse lifetime bounds in lifetime param into TypeBoundList
This mainly aids in error recovery but also makes it a bit easier to handle lifetime resolution.
While doing so it also came apparent that we were not actually lowering lifetime outlives relationships within lifetime parameter declaration bounds, so this fixes that.
2024-12-05 17:52:02 +01:00
Lukas Wirth
df7ab62a06 fix: Fix parsing of integer/keyword name refs in various places 2024-12-05 15:27:50 +01:00
Lukas Wirth
65c0b29720 Fix parsing of parenthesized type args and RTN 2024-12-04 11:48:47 +01:00
Lukas Wirth
caba872f88 fix: Don't create empty path nodes 2024-12-04 07:01:45 +01:00
Lukas Wirth
b6fc9c14ac Better parser recovery for incomplete attributes 2024-12-04 06:45:59 +01:00
Nicholas Nethercote
81aa2d2b10 Remove TokenKind::InvalidPrefix.
It was added in #123752 to handle some cases involving emoji, but it
isn't necessary because it's always treated the same as
`TokenKind::InvalidIdent`. This commit removes it, which makes things a
little simpler.
2024-11-19 18:06:22 +11:00
Chayim Refael Friedman
210ead8454 Parse patterns with leading pipe properly in all places 2024-10-31 15:32:37 +02:00
Chayim Refael Friedman
3a8dc27e72 Only parse safe as contextual kw in extern blocks
I don't like the party of `bool`s that is becoming, but two isn't worth a refactoring yet IMO.
2024-10-30 19:28:33 +02:00
Lukas Wirth
3b3a87fe9b
Merge pull request #18419 from ChayimFriedman2/leading-or
fix: Put leading `|` in patterns under `OrPat`
2024-10-27 11:25:16 +00:00
Chayim Refael Friedman
e12a001b55 Put leading | in patterns under OrPat
Previously it was one level above, and that caused problems with macros that expand to it, because macros expect to get only one top-level node.
2024-10-27 13:11:38 +02:00
Chayim Refael Friedman
3b3beaab31 Correctly handle #"" in edition <2024 2024-10-27 00:47:13 +03:00
bors
c58427ff94 Auto merge of #18371 - Veykril:veykril/push-kwttrusywysp, r=Veykril
fix: Fix incorrect parsing of use bounds

Fixes https://github.com/rust-lang/rust-analyzer/issues/18357
2024-10-22 11:42:11 +00:00
Lukas Wirth
95298a2e61 fix: Fix incorrect parsing of use bounds
Also lower them a bit more
2024-10-22 13:34:26 +02:00
Lukas Wirth
6c23f25e7f Fix new nightly lints 2024-10-22 11:48:41 +02:00
roife
834ccbffba fix: classify safe as a contextual kw 2024-10-21 02:56:21 +08:00
roife
9f1e450c4f feat: initial support for safe_kw in extern blocks 2024-10-20 17:12:52 +08:00
Laurențiu Nicola
2fe603efe7 Bump rustc crates 2024-10-17 13:11:12 +02:00
Laurențiu Nicola
7ae97c1ef1 Merge from rust-lang/rust 2024-10-17 10:04:49 +03:00
Peter Jaszkowiak
ec11c27e5c Reserve guarded string literals (RFC 3593) 2024-10-08 18:21:16 -06:00
SabrinaJewson
e735906839
fix: correctly parse use in generic parameters 2024-10-01 22:10:47 +01:00
Laurențiu Nicola
f4bcae32fe Run rustfmt 2024-09-25 09:26:15 +03:00
Laurențiu Nicola
37f7190b3e Merge from rust-lang/rust 2024-09-25 09:00:53 +03:00
Michael Goulet
8851e4fa39 Fix tools 2024-09-06 10:32:48 -04:00
Lukas Wirth
5b79d922b2 fix: Fix parser panicking on invalid asm options 2024-09-05 17:07:10 +02:00
Lukas Wirth
f74a0c8801 asm! parsing and lowering fixes 2024-09-05 15:08:16 +02:00
Lukas Wirth
811905fce8 Give InlineAsmOperand a HIR representation 2024-09-05 12:40:48 +02:00
Lukas Wirth
a600e1df73 Add Definition kind for asm register operand 2024-09-05 10:53:07 +02:00
Lukas Wirth
3b11ff8c4d Lower asm expressions 2024-09-05 09:59:08 +02:00
Lukas Wirth
86658c66b4 Parse builtin#asm expressions 2024-09-04 14:09:03 +02:00
Lukas Wirth
230cd21bed Add edition dependent keyword highlighting tests 2024-09-04 11:32:59 +02:00
Chayim Refael Friedman
21e6058ab7 Fix Return Type Syntax to include .. (i.e. method(..) and not method()) as specified in the RFC 2024-08-26 01:45:52 +03:00
Chayim Refael Friedman
9d3368f2c2 Properly account for editions in names
This PR touches a lot of parts. But the main changes are changing
`hir_expand::Name` to be raw edition-dependently and only when necessary
(unrelated to how the user originally wrote the identifier),
and changing `is_keyword()` and `is_raw_identifier()` to be edition-aware
(this was done in #17896, but the FIXMEs were fixed here).

It is possible that I missed some cases, but most IDE parts should properly
escape (or not escape) identifiers now.

The rules of thumb are:

 - If we show the identifier to the user, its rawness should be determined
   by the edition of the edited crate. This is nice for IDE features,
   but really important for changes we insert to the source code.
 - For tests, I chose `Edition::CURRENT` (so we only have to (maybe) update
   tests when an edition becomes stable, to avoid churn).
 - For debugging tools (helper methods and logs), I used `Edition::LATEST`.
2024-08-16 16:46:24 +03:00
Lukas Wirth
f90bdfc13d internal: Properly check the edition for edition dependent syntax kinds 2024-08-15 15:57:47 +02:00
Vincent Esche
7dec7e92ea Replace [package.repository] = "…" of published crates with [package.repository.workspace] = true 2024-08-06 00:26:42 +02:00
Vincent Esche
6f329e6d5b Add repository URL for published crates' missing [package.repository] fields 2024-08-06 00:25:02 +02:00
Vincent Esche
b5b0f4bc5a Replace "TBD" with more helpful desciptions in published crates' [package.description] fields 2024-08-06 00:25:02 +02:00
winstxnhdw
4a91453409 fix: move use parsing to outer match arm 2024-07-23 22:36:46 +01:00
winstxnhdw
e4941c0c73 chore: update codegens 2024-07-23 22:36:46 +01:00
winstxnhdw
61b232369b feat: add arm for use type bound 2024-07-23 22:36:46 +01:00
Lukas Wirth
41603ab14e Add missing dyn parse special cases in 2015 edition 2024-07-20 09:18:40 +02:00
Lukas Wirth
92f5e806f1 Fix edition used for include macro parsing 2024-07-19 20:29:53 +02:00
Lukas Wirth
f4199f786e Parse contextual dyn keyword properly in edition 2015 2024-07-19 20:20:30 +02:00
Lukas Wirth
2c32ee7cfa Prevent generated runner module from being format checked 2024-07-19 16:01:47 +02:00
Lukas Wirth
d235d09bf9 Parse try as a keyword only in edition 2018 and up 2024-07-19 15:43:20 +02:00
Lukas Wirth
713c47f25b Add basic edition inline parser test support 2024-07-19 15:19:43 +02:00