]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoAdd regression test
Ryo Yoshida [Sun, 25 Dec 2022 14:22:33 +0000 (23:22 +0900)]
Add regression test

18 months agofix: handle lifetime variables in `CallableSig` query
Ryo Yoshida [Sat, 24 Dec 2022 20:07:44 +0000 (05:07 +0900)]
fix: handle lifetime variables in `CallableSig` query

18 months agoAuto merge of #13830 - nyurik:lints, r=lnicola
bors [Sat, 24 Dec 2022 17:58:32 +0000 (17:58 +0000)]
Auto merge of #13830 - nyurik:lints, r=lnicola

Minor manual cleanup

* use default derive
* use `strip_prefix` where possible to avoid dup work

18 months agoAuto merge of #13831 - bvanjoi:fix_bound_type_in_trait_insert, r=Veykril
bors [Fri, 23 Dec 2022 12:27:44 +0000 (12:27 +0000)]
Auto merge of #13831 - bvanjoi:fix_bound_type_in_trait_insert, r=Veykril

fix(completion): remove bound insert of type in trait

Fixed https://github.com/rust-lang/rust-analyzer/issues/13819

18 months agofix(completion): remove bound insert of type in trait
bvanjoi [Fri, 23 Dec 2022 09:43:48 +0000 (17:43 +0800)]
fix(completion): remove bound insert of type in trait

18 months agoMinor manual cleanu
Yuri Astrakhan [Fri, 23 Dec 2022 08:07:42 +0000 (03:07 -0500)]
Minor manual cleanu

* use default derive
* use `strip_prefix` where possible to avoid dup work

18 months agoAuto merge of #13829 - nyurik:explicit-auto-deref, r=lnicola
bors [Fri, 23 Dec 2022 08:04:38 +0000 (08:04 +0000)]
Auto merge of #13829 - nyurik:explicit-auto-deref, r=lnicola

Clippy-fix explicit auto-deref

Seems like these can be safely fixed. With one, I was particularly surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```

18 months agoClippy-fix explicit auto-deref
Yuri Astrakhan [Fri, 23 Dec 2022 07:51:52 +0000 (02:51 -0500)]
Clippy-fix explicit auto-deref

Seems like these can be safely fixed. With one, I was particularly
surprised -- `Some(pats) => &**pats,` in body.rs?

```
cargo clippy --fix -- -A clippy::all -D clippy::explicit_auto_deref
```

18 months agoAuto merge of #13828 - nyurik:rm-dup-clone, r=lnicola
bors [Fri, 23 Dec 2022 07:25:42 +0000 (07:25 +0000)]
Auto merge of #13828 - nyurik:rm-dup-clone, r=lnicola

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
```

18 months agoRemove non-needed clones
Yuri Astrakhan [Fri, 23 Dec 2022 07:08:08 +0000 (02:08 -0500)]
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
```

18 months agoAuto merge of #13820 - Veykril:or-pat-bm-fix, r=Veykril
bors [Thu, 22 Dec 2022 23:02:19 +0000 (23:02 +0000)]
Auto merge of #13820 - Veykril:or-pat-bm-fix, r=Veykril

Fix binding mode hints always adding parentheses to or-patterns

18 months agoAuto merge of #13822 - WaffleLapkin:famous, r=Veykril
bors [Thu, 22 Dec 2022 11:25:54 +0000 (11:25 +0000)]
Auto merge of #13822 - WaffleLapkin:famous, r=Veykril

internal: Pass `FamousDefs` around in inlay hints

Bind after at go brrrrr

18 months agoPass `FamousDefs` around in inlay hints
Maybe Waffle [Thu, 22 Dec 2022 11:00:25 +0000 (11:00 +0000)]
Pass `FamousDefs` around in inlay hints

18 months agoAuto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril
bors [Thu, 22 Dec 2022 09:37:00 +0000 (09:37 +0000)]
Auto merge of #13817 - WaffleLapkin:hide_adjustment_hints_outside_of_unsafe, r=Veykril

feat: Add an option to hide adjustment hints outside of `unsafe` blocks and functions

As the title suggests: this PR adds an option (namely `rust-analyzer.inlayHints.expressionAdjustmentHints.hideOutsideUnsafe`) that allows to hide adjustment hints outside of `unsafe` blocks and functions:

![2022-12-21_23-11](https://user-images.githubusercontent.com/38225716/208986376-d607de62-8290-4e16-b7fe-15b762dc5f60.png)

Requested by `@BoxyUwU` <3

18 months agoFix binding mode hints always adding parentheses to or-patterns
Lukas Wirth [Thu, 22 Dec 2022 09:35:35 +0000 (10:35 +0100)]
Fix binding mode hints always adding parentheses to or-patterns

18 months agoApply suggestions from code review
Waffle Maybe [Wed, 21 Dec 2022 22:52:52 +0000 (02:52 +0400)]
Apply suggestions from code review

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
18 months agoAuto merge of #13699 - HKalbasi:inlaylink, r=Veykril
bors [Wed, 21 Dec 2022 21:43:38 +0000 (21:43 +0000)]
Auto merge of #13699 - HKalbasi:inlaylink, r=Veykril

Implement location link for type inlay hints

fix #11701

This actually doesn't work due a problem in vscode: https://github.com/microsoft/vscode/issues/167564

18 months agoAuto merge of #13818 - Veykril:layout, r=Veykril
bors [Wed, 21 Dec 2022 20:38:57 +0000 (20:38 +0000)]
Auto merge of #13818 - Veykril:layout, r=Veykril

Simplify

18 months agoMove `is_inside_unsafe` to `Semantics` impl
Maybe Waffle [Wed, 21 Dec 2022 20:34:49 +0000 (20:34 +0000)]
Move `is_inside_unsafe` to `Semantics` impl

18 months agoSimplify
Lukas Wirth [Wed, 21 Dec 2022 20:34:01 +0000 (21:34 +0100)]
Simplify

18 months agoAuto merge of #13814 - Veykril:layout, r=Veykril
bors [Wed, 21 Dec 2022 19:38:51 +0000 (19:38 +0000)]
Auto merge of #13814 - Veykril:layout, r=Veykril

Calculate the TargetDataLayout correctly for the selected target

This fails the tests still since those don't call into rustc yet

18 months agoFix tests not using appropriate target data
Lukas Wirth [Wed, 21 Dec 2022 15:01:17 +0000 (16:01 +0100)]
Fix tests not using appropriate target data

18 months agoAdd an option to hide adjustment hints outside of unsafe blocks
Maybe Waffle [Wed, 21 Dec 2022 18:18:12 +0000 (18:18 +0000)]
Add an option to hide adjustment hints outside of unsafe blocks

18 months agoAuto merge of #13771 - noritada:feature/release-notes-on-github-releases, r=lnicola
bors [Wed, 21 Dec 2022 18:37:10 +0000 (18:37 +0000)]
Auto merge of #13771 - noritada:feature/release-notes-on-github-releases, r=lnicola

Add xtask for publishing release notes in Markdown on GitHub Releases from a changelog in AsciiDoc

This PR provides `xtask publish-release-notes` to convert a changelog written in AsciiDoc to Markdown and update descriptions (release notes) of a corresponding entry on GitHub Releases.

This AsciiDoc parser is not capable of processing every AsciiDoc document, but I have surveyed a set of existing changelog entries and have confirmed that the following notations used can be converted properly. In the future, I would like to improve the parser to accept any AsciiDoc.  Alternatively, the parser could be moved out of the project.

Your feedback would be appreciated!

Closes #13191

### Supported AsciiDoc syntax

many occurrences
- [x] documentation header
- [x] section header
- [x] `*`-prefixed basic unordered single level list item
- [x] list continuation using `+`
- [x] block image macro `image::...[]` with empty alt
- [x] block image macro `image::...[]` with non-empty alt
- [x] block video marco `video::...[]` with `options=loop`
- [x] inline hard line break `+`
- [x] inline custom macro `commit:...[]`
- [x] inline custom macro `release:...[]`
- [x] inline custom macro `pr:...[]`
- [x] inline unconstrained bold text `**...**`
- [x] inline constrained monospace ``` `...`  ```

[thisweek/_posts/2019-07-24-changelog-0.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/tree/src/thisweek/_posts#:~:text=2019%2D07%2D24%2Dchangelog%2D0.adoc)
- [x] paragraphs
- [x] mixture of `*` and `-` for unordered list item prefix
- [x] inline external link `https://...[]`

[thisweek/_posts/2020-01-13-changelog-7.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/tree/src/thisweek/_posts#:~:text=2020%2D01%2D13%2Dchangelog%2D7.adoc)
- [x] list item with multiline principal text with indent
- [x] inline image macro `image:...[]`

[thisweek/_posts/2020-03-02-changelog-14.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/blob/src/thisweek/_posts/2020-03-02-changelog-14.adoc)
- [x] empty lines between list items
- [x] nested unordered list item with `**`
- [x] inline macro `kbd:[...]`

[thisweek/_posts/2020-03-16-changelog-16.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/blob/src/thisweek/_posts/2020-03-16-changelog-16.adoc)
- [x] `[source]`-prefixed listing

[thisweek/_posts/2020-04-06-changelog-19.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/blob/src/thisweek/_posts/2020-04-06-changelog-19.adoc)
- [x] list item with multiline principal text without indent
- [x] `[source,lang]`-prefixed listing
- [x] `.`-prefiexed ordered list item
- [x] list item immediately after list continuation paragraph without an empty line in between

[thisweek/_posts/2020-04-20-changelog-21.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/blob/src/thisweek/_posts/2020-04-20-changelog-21.adoc)
- [x] title line for block image

[thisweek/_posts/2020-12-21-changelog-56.adoc](https://github.com/rust-analyzer/rust-analyzer.github.io/blob/src/thisweek/_posts/2020-12-21-changelog-56.adoc)
- [x] block video `video::...[]` with `options="autoplay,loop"`

18 months agoDrive-by cleanup: fully qualify `ast::Expr` in `hir`
Maybe Waffle [Wed, 21 Dec 2022 18:17:42 +0000 (18:17 +0000)]
Drive-by cleanup: fully qualify `ast::Expr` in `hir`

18 months agoDisable inlay hint location links on vscode < 1.76
hkalbasi [Wed, 21 Dec 2022 15:24:49 +0000 (18:54 +0330)]
Disable inlay hint location links on vscode < 1.76

18 months agoCalculate the TargetDataLayout correctly for the selected target
Lukas Wirth [Wed, 21 Dec 2022 14:11:24 +0000 (15:11 +0100)]
Calculate the TargetDataLayout correctly for the selected target

18 months agoImplement location link for type inlay hints
hkalbasi [Thu, 1 Dec 2022 15:39:57 +0000 (19:09 +0330)]
Implement location link for type inlay hints

18 months agoAuto merge of #13806 - WaffleLapkin:typed_blåhaj, r=Veykril
bors [Tue, 20 Dec 2022 21:11:38 +0000 (21:11 +0000)]
Auto merge of #13806 - WaffleLapkin:typed_blåhaj, r=Veykril

fix: Skip adjustment hints if the adjustment is identity (`T` -> `T`)

Supersedes https://github.com/rust-lang/rust-analyzer/pull/13765

18 months agoSkip adjustment hints if the adjustment doesn't adjust
Maybe Waffle [Tue, 20 Dec 2022 20:04:10 +0000 (20:04 +0000)]
Skip adjustment hints if the adjustment doesn't adjust

18 months agoSave source & target types in `hir`'s `expr_adjustments`
Maybe Waffle [Tue, 20 Dec 2022 19:33:27 +0000 (19:33 +0000)]
Save source & target types in `hir`'s `expr_adjustments`

18 months agoAuto merge of #13764 - WaffleLapkin:badassexprs, r=Veykril
bors [Tue, 20 Dec 2022 18:11:54 +0000 (18:11 +0000)]
Auto merge of #13764 - WaffleLapkin:badassexprs, r=Veykril

fix: Correctly check for parentheses redundancy in `remove_parentheses` assist

This is quite a bunch of code and some hacks, but I _think_ this time it's correct.

I've added a lot of tests, most of which fail with the assist impl from #13733 :')

18 months agoAuto merge of #13805 - ntBre:master, r=jonas-schievink
bors [Tue, 20 Dec 2022 17:58:41 +0000 (17:58 +0000)]
Auto merge of #13805 - ntBre:master, r=jonas-schievink

Complete enum variants without parens when snippets are disabled

This handles the portion of #13767 that bothered me, but I can try to work on the other parts we discussed if needed.

18 months agopass `snippet_cap` to `format_literal_label`, return early if None
Brent Westbrook [Tue, 20 Dec 2022 16:27:19 +0000 (11:27 -0500)]
pass `snippet_cap` to `format_literal_label`, return early if None

18 months agoreturn immediately from `render_tuple_lit` if `snippet_cap` is None
Brent Westbrook [Tue, 20 Dec 2022 16:07:37 +0000 (11:07 -0500)]
return immediately from `render_tuple_lit` if `snippet_cap` is None

partially addresses #13767

18 months agoDon't panic in `Expr::needs_parens_in`
Maybe Waffle [Tue, 20 Dec 2022 15:16:26 +0000 (15:16 +0000)]
Don't panic in `Expr::needs_parens_in`

18 months agoAuto merge of #13804 - WaffleLapkin:inlay_hint_mods, r=Veykril
bors [Tue, 20 Dec 2022 14:18:49 +0000 (14:18 +0000)]
Auto merge of #13804 - WaffleLapkin:inlay_hint_mods, r=Veykril

Split inlay hints into modules per hint type

I think this makes the code a lot easier to maintain.

18 months agoAdd docs to make tidy tests happy :')
Maybe Waffle [Tue, 20 Dec 2022 13:30:53 +0000 (13:30 +0000)]
Add docs to make tidy tests happy :')

18 months agoMove inlay hints tests into implementation modules
Maybe Waffle [Tue, 20 Dec 2022 12:45:31 +0000 (12:45 +0000)]
Move inlay hints tests into implementation modules

18 months agoSplit inlay hints into modules
Maybe Waffle [Fri, 16 Dec 2022 16:13:46 +0000 (16:13 +0000)]
Split inlay hints into modules

18 months agoAuto merge of #13800 - lowr:fix/mbe-expr-backwards-compat, r=Veykril
bors [Tue, 20 Dec 2022 12:01:30 +0000 (12:01 +0000)]
Auto merge of #13800 - lowr:fix/mbe-expr-backwards-compat, r=Veykril

fix: don't let mbe expr fragments match let exprs and inline consts

Fixes #11729

`expr` fragment in mbe should not match let expressions and inline consts for backwards compatibility. See rust-lang/rust#86730 for details.

This patch is porting [this logic in rustc](https://github.com/rust-lang/rust/blob/f0c4da49983aa699f715caf681e3154b445fb60b/compiler/rustc_parse/src/parser/nonterminal.rs#L28-L34) (which is called [here in rustc's mbe engine](https://github.com/rust-lang/rust/blob/f0c4da49983aa699f715caf681e3154b445fb60b/compiler/rustc_expand/src/mbe/macro_parser.rs#L576)) to our mbe engine.

18 months agofix: don't let mbe expr fragments match let exprs and inline consts
Ryo Yoshida [Tue, 20 Dec 2022 11:31:47 +0000 (20:31 +0900)]
fix: don't let mbe expr fragments match let exprs and inline consts

18 months agoAuto merge of #13795 - jonas-schievink:fix-rustfmt-edition-in-path-deps, r=jonas...
bors [Mon, 19 Dec 2022 16:57:12 +0000 (16:57 +0000)]
Auto merge of #13795 - jonas-schievink:fix-rustfmt-edition-in-path-deps, r=jonas-schievink

fix: Use the correct edition when formatting code in path dependencies

Fixes https://github.com/rust-lang/rust-analyzer/issues/13790

Don't go through the Cargo workspace info, since that doesn't contain path dependencies. Instead, query the crate graph via `Analysis::crate_edition`.

18 months agoUse the correct edition when formatting path deps
Jonas Schievink [Mon, 19 Dec 2022 16:53:56 +0000 (17:53 +0100)]
Use the correct edition when formatting path deps

18 months agoAuto merge of #13794 - jonas-schievink:reset-step-limit-after-bump, r=jonas-schievink
bors [Mon, 19 Dec 2022 16:07:40 +0000 (16:07 +0000)]
Auto merge of #13794 - jonas-schievink:reset-step-limit-after-bump, r=jonas-schievink

fix: fix "parser seems stuck" panic when parsing colossal files

The parser step count is incremented every time the parser inspects a token. It's purpose is to ensure the parser doesn't get stuck in infinite loops. But since `self.pos` grows monotonically when parsing source code, it gives a better idea for whether the parser is stuck or not: if `self.pos` is changed, we know that the parser cannot be stuck, so it is safe to reset the step count to 0. This makes the limit check scale with the size of the file, and so should fix https://github.com/rust-lang/rust-analyzer/issues/13788.

18 months agoReset parser step count when bumping
Jonas Schievink [Mon, 19 Dec 2022 15:27:00 +0000 (16:27 +0100)]
Reset parser step count when bumping

18 months agoAuto merge of #13792 - Veykril:flycheck, r=Veykril
bors [Sat, 17 Dec 2022 22:45:08 +0000 (22:45 +0000)]
Auto merge of #13792 - Veykril:flycheck, r=Veykril

Add a command to clear flycheck diagnostics

And document the flycheck notifications

18 months agoAdd a command to clear flycheck diagnostics
Lukas Wirth [Sat, 17 Dec 2022 22:43:26 +0000 (23:43 +0100)]
Add a command to clear flycheck diagnostics

18 months agoMake cancelFlycheck request a notification
Lukas Wirth [Sat, 17 Dec 2022 22:29:25 +0000 (23:29 +0100)]
Make cancelFlycheck request a notification

18 months agoMake manual flycheck runs work when checkOnSave is disabled
Lukas Wirth [Sat, 17 Dec 2022 22:26:54 +0000 (23:26 +0100)]
Make manual flycheck runs work when checkOnSave is disabled

18 months agoAuto merge of #13785 - Veykril:run-flycheck, r=Veykril
bors [Fri, 16 Dec 2022 22:06:35 +0000 (22:06 +0000)]
Auto merge of #13785 - Veykril:run-flycheck, r=Veykril

Add command for manually running flychecks

Closes https://github.com/rust-lang/rust-analyzer/issues/13125

18 months agoAdd command for manually running flychecks
Lukas Wirth [Fri, 16 Dec 2022 21:43:14 +0000 (22:43 +0100)]
Add command for manually running flychecks

18 months agoAuto merge of #13784 - Veykril:bm-hints, r=Veykril
bors [Fri, 16 Dec 2022 20:51:20 +0000 (20:51 +0000)]
Auto merge of #13784 - Veykril:bm-hints, r=Veykril

Deduplicate inserted parentheses in binding mode hints

18 months agoDeduplicate inserted parentheses in binding mode hints
Lukas Wirth [Fri, 16 Dec 2022 20:16:55 +0000 (21:16 +0100)]
Deduplicate inserted parentheses in binding mode hints

18 months agoAuto merge of #13783 - Veykril:bm-hints, r=Veykril
bors [Fri, 16 Dec 2022 19:53:06 +0000 (19:53 +0000)]
Auto merge of #13783 - Veykril:bm-hints, r=Veykril

Add parentheses for binding mode hints when they attach to an Or-pattern

18 months agoAdd parentheses for binding mode hints when they attach to an Or-pattern
Lukas Wirth [Fri, 16 Dec 2022 19:52:31 +0000 (20:52 +0100)]
Add parentheses for binding mode hints when they attach to an Or-pattern

18 months agoAuto merge of #13777 - dzvon:fix-13776, r=jonas-schievink
bors [Fri, 16 Dec 2022 03:23:38 +0000 (03:23 +0000)]
Auto merge of #13777 - dzvon:fix-13776, r=jonas-schievink

fix: add a check for `if` token in patterns parser

Closes #13776

18 months agodocs: update the comment and add a test to `half_open_range_pat`
Dezhi Wu [Fri, 16 Dec 2022 02:44:25 +0000 (10:44 +0800)]
docs: update the comment and add a test to `half_open_range_pat`

18 months agoMake minor improvements and cleanups
Noritada Kobayashi [Thu, 15 Dec 2022 05:52:23 +0000 (14:52 +0900)]
Make minor improvements and cleanups

18 months agoSplit the input/output data of the conversion from the test code to the respective...
Noritada Kobayashi [Thu, 15 Dec 2022 05:25:59 +0000 (14:25 +0900)]
Split the input/output data of the conversion from the test code to the respective files

18 months agofix: add a check for `if` token in patterns parser
Dezhi Wu [Thu, 15 Dec 2022 04:46:02 +0000 (12:46 +0800)]
fix: add a check for `if` token in patterns parser

Closes #13776

18 months agoAuto merge of #13772 - noritada:minor/set-experimental-attr-to-changelog-draft, r...
bors [Wed, 14 Dec 2022 14:54:19 +0000 (14:54 +0000)]
Auto merge of #13772 - noritada:minor/set-experimental-attr-to-changelog-draft, r=lnicola

minor: Set the `experimental` AsciiDoc document attribute to generated draft changelog

This PR sets the `experimental` AsciiDoc document attribute to generated draft changelog.

That attribute is required by the keyboard macro (`kbd:[...]`).
This change of the draft will prevent issues like https://github.com/rust-analyzer/rust-analyzer.github.io/pull/191 .

18 months agoAuto merge of #13774 - lowr:fix/no-infer-vars-in-inference-result, r=Veykril
bors [Wed, 14 Dec 2022 14:27:32 +0000 (14:27 +0000)]
Auto merge of #13774 - lowr:fix/no-infer-vars-in-inference-result, r=Veykril

fix: resolve all inference vars in `InferenceResult::assoc_resolutions`

I think this fixes '#13773, ~but still haven't found repro. I'll try finding one so we can have a regression test~.

We should resolve every inference variable in `InferenceResult` after inference is done. We started recording `Substitution`s for each resolved associated items in #13725, but failed to do so which causes crash when analyzing source in IDE layer.

18 months agoAuto merge of #13769 - jonas-schievink:parse-half-open-range-pat, r=jonas-schievink
bors [Wed, 14 Dec 2022 14:14:46 +0000 (14:14 +0000)]
Auto merge of #13769 - jonas-schievink:parse-half-open-range-pat, r=jonas-schievink

feat: Parse half-open `..= X` patterns

Closes https://github.com/rust-lang/rust-analyzer/issues/13739

18 months agofix: resolve all inference vars in `InferenceResult::assoc_resolutions`
Ryo Yoshida [Wed, 14 Dec 2022 12:56:55 +0000 (21:56 +0900)]
fix: resolve all inference vars in `InferenceResult::assoc_resolutions`

18 months agoAuto merge of #13766 - rust-lang:fix-config-patch, r=Veykril
bors [Wed, 14 Dec 2022 13:50:29 +0000 (13:50 +0000)]
Auto merge of #13766 - rust-lang:fix-config-patch, r=Veykril

Fix wrong config patching logic for addCallParenthesis

18 months agominor: Set the `experimental` AsciiDoc document attribute to generated draft changelog
Noritada Kobayashi [Wed, 14 Dec 2022 09:49:26 +0000 (18:49 +0900)]
minor: Set the `experimental` AsciiDoc document attribute to generated draft changelog

The keyboard macro (`kbd:[...]`) requires this attribute.

This default change will prevent issues like
https://github.com/rust-analyzer/rust-analyzer.github.io/pull/191 .

18 months agoAdd a link to the original changelog from release notes on GitHub Releases
Noritada Kobayashi [Wed, 14 Dec 2022 05:14:55 +0000 (14:14 +0900)]
Add a link to the original changelog from release notes on GitHub Releases

18 months agoIntegrate inline macro support with the main AsciiDoc-to-Markdown conversion process
Noritada Kobayashi [Wed, 14 Dec 2022 04:33:20 +0000 (13:33 +0900)]
Integrate inline macro support with the main AsciiDoc-to-Markdown conversion process

18 months agoImplement inline macro handling for AsciiDoc-to-Markdown conversion
Noritada Kobayashi [Tue, 13 Dec 2022 17:12:24 +0000 (02:12 +0900)]
Implement inline macro handling for AsciiDoc-to-Markdown conversion

18 months agoParse `..= X` patterns
Jonas Schievink [Tue, 13 Dec 2022 16:32:25 +0000 (17:32 +0100)]
Parse `..= X` patterns

18 months agoFix wrong config patching logic for addCallParenthesis
Florian Diebold [Tue, 13 Dec 2022 15:39:00 +0000 (16:39 +0100)]
Fix wrong config patching logic for addCallParenthesis

18 months agoMake `curl` fail on errors in `xtask publish-release-notes`
Noritada Kobayashi [Tue, 13 Dec 2022 04:05:11 +0000 (13:05 +0900)]
Make `curl` fail on errors in `xtask publish-release-notes`

18 months agoFix "needs parens" check in `remove_parentheses` assist
Maybe Waffle [Tue, 13 Dec 2022 00:06:00 +0000 (00:06 +0000)]
Fix "needs parens" check in `remove_parentheses` assist

18 months agoAuto merge of #13746 - feniljain:fix_extract_function, r=jonas-schievink
bors [Mon, 12 Dec 2022 14:51:03 +0000 (14:51 +0000)]
Auto merge of #13746 - feniljain:fix_extract_function, r=jonas-schievink

fix: make make_body respect comments in extract_function

Possible fix for #13621

### Points to help in review:

- Earlier we were only considering statements in a block expr and hence comments were being ignored, now we handle tokens hence making it aware of comments and then preserving them using `hacky_block_expr_with_comments`

Seems like I am not able to attach output video, github is glitching for it :(

18 months agoAuto merge of #13715 - feniljain:fix_completions, r=jonas-schievink
bors [Mon, 12 Dec 2022 14:37:45 +0000 (14:37 +0000)]
Auto merge of #13715 - feniljain:fix_completions, r=jonas-schievink

fix: breaking snippets on typed incomplete suggestions

Possible fix for #7929

Fix the case where if a user types `&&42.o`, snippet completion was still applying &&Ok(42). Note this was fixed previously on `&&42.` but this still remained a problem for this case

Previous relevant PR: #13517

### Points to help in review:

- The main problem why everything broke on adding an extra `o` was, earlier `dot_receiver` was `42.` which was a `LITERAL` but now `42.o` becomes a `FIELD_EXPR`

- Till now `include_references` was just checking for parent of `LITERAL` and if it was a `REF_EXPR`, but now we consider `FIELD_EXPR` and traverse all of them, finally to reach `REF_EXPR`. If `REF_EXPR` is not found we  just return the original `initial_element`

- We are constructing a new node during `include_references` because if we rely on `dot_receiver` solely we would get `&&42.o` to be replaced with, but we want `&&42` to be replaced with

### Output Video:

https://user-images.githubusercontent.com/49019259/205420166-efbdef78-5b3a-4aef-ab4b-d892dac056a0.mov

Hope everything I wrote makes sense 😅

Also interestingly previous PR's number was `13517` and this PR's number is `13715`, nicee

18 months agoAuto merge of #13726 - feniljain:fix_assists, r=jonas-schievink
bors [Mon, 12 Dec 2022 14:06:45 +0000 (14:06 +0000)]
Auto merge of #13726 - feniljain:fix_assists, r=jonas-schievink

feat: allow unwrap block in let initializers

Possible fix for #13679

### Points to help in review:

- I just added a parent case for let statements and it seems everything else was in place already, so turned out to be a small fix

18 months agoAuto merge of #13732 - rami3l:fix/gen-partial-eq, r=jonas-schievink
bors [Mon, 12 Dec 2022 13:52:49 +0000 (13:52 +0000)]
Auto merge of #13732 - rami3l:fix/gen-partial-eq, r=jonas-schievink

fix: add fallback case in generated `PartialEq` impl

Partially fixes #13727.

When generating `PartialEq` implementations for enums, the original code can already generate the following fallback case:

```rs
_ => std::mem::discriminant(self) == std::mem::discriminant(other),
```

However, it has been suppressed in the following example for no good reason:

```rs
enum Either<T, U> {
    Left(T),
    Right(U),
}

impl<T, U> PartialEq for Either<T, U> {
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (Self::Left(l0), Self::Left(r0)) => l0 == r0,
            (Self::Right(l0), Self::Right(r0)) => l0 == r0,
            // _ => std::mem::discriminant(self) == std::mem::discriminant(other),
            // ^ this completes the match arms!
        }
    }
}
```

This PR has removed that suppression logic.

~~Of course, the PR could have suppressed the fallback case generation for single-variant enums instead, but I believe that this case is quite rare and should be caught by `#[warn(unreachable_patterns)]` anyway.~~

After this fix, when the enum has >1 variants, the following fallback arm will be generated :

* `_ => false,` if we've already gone through every case where the variants of `self` and `other` match;
* The original one (as stated above) in other cases.

---

Note: The code example is still wrong after the fix due to incorrect trait bounds.

18 months agoAuto merge of #13762 - jonas-schievink:underscore-expr-first, r=jonas-schievink
bors [Mon, 12 Dec 2022 12:12:02 +0000 (12:12 +0000)]
Auto merge of #13762 - jonas-schievink:underscore-expr-first, r=jonas-schievink

fix: Fix parsing of `_ = x` in closure body

Fixes https://github.com/rust-lang/rust-analyzer/issues/13757

18 months agoFix parsing of `_ = x` in closure body
Jonas Schievink [Mon, 12 Dec 2022 11:57:29 +0000 (12:57 +0100)]
Fix parsing of `_ = x` in closure body

18 months agoCorrect complex list item support in AsciiDoc-to-Markdown conversion
Noritada Kobayashi [Mon, 12 Dec 2022 04:09:18 +0000 (13:09 +0900)]
Correct complex list item support in AsciiDoc-to-Markdown conversion

Support for following cases are added:

- newlines between list items
- list item with multiline principal text with or without indent
- list item immediately after a list continuation paragraph without
  empty lines in between

18 months agoUpdate the release process documentation to run `xtask publish-release-notes`
Noritada Kobayashi [Sun, 11 Dec 2022 17:09:31 +0000 (02:09 +0900)]
Update the release process documentation to run `xtask publish-release-notes`

18 months agoImplement `xtask publish-release-notes` to publish release notes on GitHub Releases
Noritada Kobayashi [Sun, 11 Dec 2022 14:49:28 +0000 (23:49 +0900)]
Implement `xtask publish-release-notes` to publish release notes on GitHub Releases

18 months agoAdd support for list nesting in AsciiDoc-to-Markdown conversion
Noritada Kobayashi [Sun, 11 Dec 2022 05:58:49 +0000 (14:58 +0900)]
Add support for list nesting in AsciiDoc-to-Markdown conversion

Support for following list item types are also added:

  - `-`-prefixed unordered list items
  - `.`-prefixed ordered list items

18 months agoAuto merge of #13756 - flodiebold:simplify-assoc-item-subst, r=flodiebold
bors [Sat, 10 Dec 2022 16:06:54 +0000 (16:06 +0000)]
Auto merge of #13756 - flodiebold:simplify-assoc-item-subst, r=flodiebold

Make assoc_resolutions always have a Substitution

18 months agoMake assoc_resolutions always have a Substitution
Florian Diebold [Sat, 10 Dec 2022 16:05:33 +0000 (17:05 +0100)]
Make assoc_resolutions always have a Substitution

18 months agoAuto merge of #13725 - bvanjoi:resolve-const-triat-impls, r=flodiebold
bors [Sat, 10 Dec 2022 13:58:28 +0000 (13:58 +0000)]
Auto merge of #13725 - bvanjoi:resolve-const-triat-impls, r=flodiebold

feat: resolve const for trait impls

Fixed #13694

18 months agofeat: resolve const for trait impls(close #13694)
bvanjoi [Mon, 5 Dec 2022 01:53:11 +0000 (09:53 +0800)]
feat: resolve const for trait impls(close #13694)

18 months agoAuto merge of #13750 - lowr:fix/rpit-in-projection, r=flodiebold
bors [Sat, 10 Dec 2022 11:30:14 +0000 (11:30 +0000)]
Auto merge of #13750 - lowr:fix/rpit-in-projection, r=flodiebold

fix: normalize projection after discarding free `BoundVar`s in RPIT

Fixes #13307

When we lower the return type of a function, it may contain free `BoundVar`s in `OpaqueType`'s substitution, which would cause panic during canonicalization as part of projection normalization. Those `BoundVar`s are irrelevant in this context and will be discarded, and we should defer projection normalization until then.

18 months agoAuto merge of #13742 - lowr:fix/assoc-type-shorthand-with-gats, r=flodiebold
bors [Sat, 10 Dec 2022 11:17:18 +0000 (11:17 +0000)]
Auto merge of #13742 - lowr:fix/assoc-type-shorthand-with-gats, r=flodiebold

fix: only shift `BoundVar`s that come from outside lowering context

Fixes #13734

There are some free functions `TyLoweringContext` methods call, which do not know anything about current binders in scope. We need to shift in the `BoundVar`s in substitutions that we get from them (#4952), but not those we get from `TyLoweringContext` methods.

18 months agoAdd image/video media support in AsciiDoc-to-Markdown conversion
Noritada Kobayashi [Sat, 10 Dec 2022 09:22:57 +0000 (18:22 +0900)]
Add image/video media support in AsciiDoc-to-Markdown conversion

18 months agoAuto merge of #13749 - WaffleLapkin:remove_some_redudant_adjustment_hints, r=Veykril
bors [Fri, 9 Dec 2022 19:36:05 +0000 (19:36 +0000)]
Auto merge of #13749 - WaffleLapkin:remove_some_redudant_adjustment_hints, r=Veykril

fix: Don't show duplicated adjustment hints for blocks, ifs and matches

Before:
![2022-12-09_21-10](https://user-images.githubusercontent.com/38225716/206761100-5511d91b-2543-4166-aa2c-abdb8bad3613.png)
After:
![2022-12-09_21-22](https://user-images.githubusercontent.com/38225716/206761113-c58dbb5a-8616-4287-a3b4-69c13703294d.png)

----

I want to improve adjustment hints, this is the first step :)

18 months agofix: normalize projection after discarding free `BoundVar`s in RPIT
Ryo Yoshida [Fri, 9 Dec 2022 19:07:00 +0000 (04:07 +0900)]
fix: normalize projection after discarding free `BoundVar`s in RPIT

18 months agofix: Don't show duplicated adjustment hints for blocks, ifs and matches
Maybe Waffle [Fri, 9 Dec 2022 17:40:54 +0000 (17:40 +0000)]
fix: Don't show duplicated adjustment hints for blocks, ifs and matches

18 months agoAuto merge of #13745 - Veykril:ty-hint-variant-field, r=Veykril
bors [Fri, 9 Dec 2022 16:59:02 +0000 (16:59 +0000)]
Auto merge of #13745 - Veykril:ty-hint-variant-field, r=Veykril

Show type info on hover of enum variant fields

Small addition to https://github.com/rust-lang/rust-analyzer/pull/13490

18 months agoImport the initial implementation of AsciiDoc-to-Markdown conversion
Noritada Kobayashi [Fri, 9 Dec 2022 14:45:45 +0000 (23:45 +0900)]
Import the initial implementation of AsciiDoc-to-Markdown conversion

18 months agofix: make make_body respect comments in extract_function
feniljain [Fri, 9 Dec 2022 13:00:30 +0000 (18:30 +0530)]
fix: make make_body respect comments in extract_function

18 months agoAuto merge of #13733 - WaffleLapkin:remove_parens, r=Veykril
bors [Fri, 9 Dec 2022 11:42:09 +0000 (11:42 +0000)]
Auto merge of #13733 - WaffleLapkin:remove_parens, r=Veykril

feat: Add "Remove redundant parentheses" assist

![Peek 2022-12-08 22-22](https://user-images.githubusercontent.com/38225716/206542898-d6c97468-d615-4c5b-8650-f89b9c0321a0.gif)

Can be quite handy when refactoring :)

18 months agoAuto merge of #13722 - MariaSolOs:add-json-contrib, r=Veykril
bors [Fri, 9 Dec 2022 11:29:10 +0000 (11:29 +0000)]
Auto merge of #13722 - MariaSolOs:add-json-contrib, r=Veykril

Add VS Code schema validation for `rust-project.json`

Now that https://github.com/SchemaStore/schemastore/pull/2628 has been merged, adding the `jsonValidation` contribution to the VS Code extension for better editor support when modifying `rust-project.json` files.

Related issue: #13714

18 months agoShow type info on hover of enum variant fields
Lukas Wirth [Fri, 9 Dec 2022 09:09:55 +0000 (10:09 +0100)]
Show type info on hover of enum variant fields