Commit graph

399 commits

Author SHA1 Message Date
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 returns 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
Lukas Wirth
679df2adf1 Specify rust-version via workspace.package 2023-01-16 16:33:01 +01:00
arcnmx
25242fe93f ⬆️ rust-analyzer
Merge commit '368e0bb32f1178cf162c2ce5f7e10b7ae211eb26'
2023-01-09 10:36:22 -08:00
Daniel Eades
aa90d02079 remove useless operations 2023-01-02 15:02:54 +00:00
Daniel Eades
0a0817905e return value directly from if/else block 2023-01-02 15:02:54 +00:00
Maybe Waffle
4a16afa264 Parse do yeet expressions 2022-12-28 22:42:26 +00:00
Yuri Astrakhan
d3dbf9c194 Moar linting: needless_borrow, let_unit_value, ...
* There are a few needless borrows that don't seem to be needed. I even did a quick assembly comparison and posted a q to stackoveflow on it. See [here](https://stackoverflow.com/questions/74910196/advantages-of-pass-by-ref-val-with-impl-intoiteratoritem-impl-asrefstr)
* removed several `let _ = ...` when they don't look necessary (even a few ones that were not suggested by clippy (?))
* there were a few `then(|| ctor{})` that clippy suggested to replace with `then_some(ctor{})` -- seems reasonable?
* some unneeded assignment+return - keep the code a bit leaner
* a few `writeln!` instead of `write!`, or even consolidate write!
* a nice optimization to use `ch.is_ascii_digit` instead of `ch.is_digit(10)`
2022-12-25 05:07:47 -05:00
Yuri Astrakhan
e16c76e3c3 Inline all format arguments where possible
This makes code more readale and concise,
moving all format arguments like `format!("{}", foo)`
into the more compact `format!("{foo}")` form.

The change was automatically created with, so there are far less change
of an accidental typo.

```
cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args
```
2022-12-24 14:36:10 -05:00
Yuri Astrakhan
1d59c7b667 Remove non-needed clones
I am not certain if this will improve performance,
but it seems having a .clone() without any need should be removed.

This was done with clippy, and manually reviewed:

```
cargo clippy --fix -- -A clippy::all -D clippy::redundant_clone
```
2022-12-23 02:20:03 -05:00
Jonas Schievink
c110481dd4 Reset parser step count when bumping 2022-12-19 16:27:00 +01:00
Dezhi Wu
258e532434 docs: update the comment and add a test to half_open_range_pat 2022-12-16 10:44:25 +08:00
Dezhi Wu
6a295fcd3b fix: add a check for if token in patterns parser
Closes #13776
2022-12-15 12:46:02 +08:00
Jonas Schievink
9e0aaf4cf3 Parse ..= X patterns 2022-12-13 17:32:25 +01:00
Jonas Schievink
ed48bd8b9d Fix parsing of _ = x in closure body 2022-12-12 12:57:29 +01:00
Laurențiu Nicola
a2a1d99545 ⬆️ rust-analyzer 2022-11-23 17:24:03 +02:00
Lukas Wirth
ffd7bf8bf9 Bump Cargo rust-version fields to latest stable 2022-11-07 12:59:51 +01:00
Laurențiu Nicola
65e1dc4d9c ⬆️ rust-analyzer 2022-09-06 21:20:49 +03:00
bors
93c52e41ec Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink
fix: Parse TypePathFn with preceding `::`

e.g. `impl Fn::() -> ()`.

Fixes #13157. This was the problem, not that the path was not at the end.

I could unify the parsing of `::` of TypePathFn with that of generic arg list, but some code relies on the `::` of generic arg list to be inside it.
2022-09-01 21:00:14 +00:00
Chayim Refael Friedman
d786a40e73 Parse TypePathFn with preceding ::
e.g. `impl Fn::() -> ()`.
2022-08-31 23:19:09 +00:00
bors
d9e22079c4 Auto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril
clippy: make generated code nice to read

Feel free to close if this is too minor.

(For context, I _have_ read the clippy policy in `dev/style.md`)
2022-08-31 08:37:14 +00:00
Laurențiu Nicola
3e358a6827 ⬆️ rust-analyzer 2022-08-30 14:51:24 +03:00
Jonas Schievink
8969655ed6 Allow leading | in more pattern positions 2022-08-23 16:31:59 +02:00
Laurențiu Nicola
8231fee466 ⬆️ rust-analyzer 2022-08-16 11:24:50 +03:00