]> git.lizzy.rs Git - rust.git/log
rust.git
20 months agoMerge commit 'f5fde4df4' into HEAD
Amos Wenger [Fri, 25 Nov 2022 12:02:44 +0000 (13:02 +0100)]
Merge commit 'f5fde4df4' into HEAD

20 months agoMerge commit '2e9f1204ca01c3e20898d4a67c8b84899d394a88' into HEAD
Amos Wenger [Fri, 25 Nov 2022 12:02:11 +0000 (13:02 +0100)]
Merge commit '2e9f1204ca01c3e20898d4a67c8b84899d394a88' into HEAD

20 months agoMerge commit '459bbb422' into HEAD
Amos Wenger [Fri, 25 Nov 2022 12:02:06 +0000 (13:02 +0100)]
Merge commit '459bbb422' into HEAD

20 months agoMerge commit '67920f797511c360b25dab4d30730be304848f32' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:58:20 +0000 (12:58 +0100)]
Merge commit '67920f797511c360b25dab4d30730be304848f32' into HEAD

20 months agoMerge commit '65e1dc4d9' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:58:18 +0000 (12:58 +0100)]
Merge commit '65e1dc4d9' into HEAD

20 months agoMerge commit 'e8e598f6415461e7fe957eec1bee6afb55927d59' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:58:02 +0000 (12:58 +0100)]
Merge commit 'e8e598f6415461e7fe957eec1bee6afb55927d59' into HEAD

20 months agoMerge commit '3e358a682' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:58:00 +0000 (12:58 +0100)]
Merge commit '3e358a682' into HEAD

20 months agoMerge commit 'a670ff888437f4b6a3d24cc2996e9f969a87cbae' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:57:43 +0000 (12:57 +0100)]
Merge commit 'a670ff888437f4b6a3d24cc2996e9f969a87cbae' into HEAD

20 months agoMerge commit '31519bb39' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:57:38 +0000 (12:57 +0100)]
Merge commit '31519bb39' into HEAD

20 months agoMerge commit 'b6d59f2bb4fae0ba4f74e2c967b5e2f777f8c860' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:55:14 +0000 (12:55 +0100)]
Merge commit 'b6d59f2bb4fae0ba4f74e2c967b5e2f777f8c860' into HEAD

20 months agoMerge commit '8231fee46' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:55:08 +0000 (12:55 +0100)]
Merge commit '8231fee46' into HEAD

20 months agoMerge commit '634cfe3d72e785c843ca5d412b12be137b2e14fb' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:54:28 +0000 (12:54 +0100)]
Merge commit '634cfe3d72e785c843ca5d412b12be137b2e14fb' into HEAD

20 months agoMerge commit '22c8c9c40' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:13:34 +0000 (12:13 +0100)]
Merge commit '22c8c9c40' into HEAD

20 months agoMerge commit '8e38833c3674c1be7d81c6069c62e6ed52b18b27' into HEAD
Amos Wenger [Fri, 25 Nov 2022 11:01:49 +0000 (12:01 +0100)]
Merge commit '8e38833c3674c1be7d81c6069c62e6ed52b18b27' into HEAD

22 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 20 Sep 2022 14:39:17 +0000 (17:39 +0300)]
:arrow_up: rust-analyzer

22 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 13 Sep 2022 12:38:11 +0000 (15:38 +0300)]
:arrow_up: rust-analyzer

22 months agoAuto merge of #13214 - SpencerSharkey:ubuntu-container-build, r=lnicola
bors [Sun, 11 Sep 2022 11:34:25 +0000 (11:34 +0000)]
Auto merge of #13214 - SpencerSharkey:ubuntu-container-build, r=lnicola

Build release artifact against older Glibc

When GitHub [deprecated Ubuntu 18.04](https://github.blog/changelog/2022-08-09-github-actions-the-ubuntu-18-04-actions-runner-image-is-being-deprecated-and-will-be-removed-by-12-1-22/) runners, rust-analyzer was forced to bump runners to 20.04 which includes an updated Glib. This renders RA incompatible with the still popular Ubuntu 18.04 and other slightly older distro versions.

Until a deprecation plan is announced on RA's side, I propose binaries shall be built against older glibc to maintain compatibility.

This PR changes the Release CI workflow to build the `linux-x64/x86_64-unknown-linux-gnu` release in an Ubuntu 18.04 container.

Fixes #13081 and #13085

22 months agouse rustup minimal profile and add curl retries
Spencer [Sun, 11 Sep 2022 06:43:33 +0000 (23:43 -0700)]
use rustup minimal profile and add curl retries

22 months agoadd rustup bin to path
Spencer [Sun, 11 Sep 2022 06:29:15 +0000 (23:29 -0700)]
add rustup bin to path

22 months agoinstall rustup directly
Spencer [Sun, 11 Sep 2022 06:25:30 +0000 (23:25 -0700)]
install rustup directly

22 months agorevert conditional logic for apt update step
Spencer [Sun, 11 Sep 2022 01:10:56 +0000 (18:10 -0700)]
revert conditional logic for apt update step

22 months agouse ubuntu 18.04 container for release
Spencer Sharkey [Fri, 9 Sep 2022 05:29:08 +0000 (22:29 -0700)]
use ubuntu 18.04 container for release

22 months agoAuto merge of #13207 - randomicon00:semicol#13196, r=lnicola
bors [Fri, 9 Sep 2022 04:15:20 +0000 (04:15 +0000)]
Auto merge of #13207 - randomicon00:semicol#13196, r=lnicola

fix: add semicolon completion to mod

fixes #13196

`@Veykril` The tests are passing. I added one specifically for this case.

22 months agofix: removed swap file
Peh [Thu, 8 Sep 2022 21:44:10 +0000 (22:44 +0100)]
fix: removed swap file

22 months agofix: add semicolon completion to mod
Peh [Thu, 8 Sep 2022 21:37:31 +0000 (22:37 +0100)]
fix: add semicolon completion to mod

22 months agoAuto merge of #13158 - jonas-schievink:inlayhint-links, r=jonas-schievink
bors [Thu, 8 Sep 2022 16:38:40 +0000 (16:38 +0000)]
Auto merge of #13158 - jonas-schievink:inlayhint-links, r=jonas-schievink

feat: make clicking a closing brace inlay hint go to the opening brace

22 months agoUpdate crates/rust-analyzer/src/to_proto.rs
Jonas Schievink [Thu, 8 Sep 2022 16:33:53 +0000 (18:33 +0200)]
Update crates/rust-analyzer/src/to_proto.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
22 months agoMake clicking closing brace hint go to the opening brace
Jonas Schievink [Wed, 31 Aug 2022 16:54:19 +0000 (18:54 +0200)]
Make clicking closing brace hint go to the opening brace

22 months agoAuto merge of #13200 - P1n3appl3:sysroot, r=Veykril
bors [Wed, 7 Sep 2022 09:36:03 +0000 (09:36 +0000)]
Auto merge of #13200 - P1n3appl3:sysroot, r=Veykril

Use proc-macro-srv from sysroot in rust-project.json workspaces

This was discussed [on zulip](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/.60sysroot.60.20vs.20.60sysroot_src.60.20for.20.60rust-project.2Ejson.60.3F/near/293023920), basically in `rust-project.json` workspaces RA doesn't respect the `sysroot` setting when picking which `proc-macro-srv` to launch, and this causes abi mismatches in practice.

This is the simple fix that `@Veykril` suggested, and I've verified that it works on Fuchsia by inspecting the cmdline with `pgrep rust-analyzer | xargs ps -fp` to check that it's using the `proc-macro-srv` from our prebuilts which matches the `sysroot` specified in our `rust-project.json`.

Can this be merged as is, or do we need to add tests that exercise this?

22 months agoUse proc-macro-srv from sysroot in rust-project.json
Joseph Ryan [Wed, 7 Sep 2022 01:27:17 +0000 (18:27 -0700)]
Use proc-macro-srv from sysroot in rust-project.json

22 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 6 Sep 2022 18:20:49 +0000 (21:20 +0300)]
:arrow_up: rust-analyzer

22 months agoAuto merge of #13192 - lowr:fix/dyn-sort-all-bounds, r=Veykril
bors [Mon, 5 Sep 2022 11:24:54 +0000 (11:24 +0000)]
Auto merge of #13192 - lowr:fix/dyn-sort-all-bounds, r=Veykril

fix: sort all bounds on trait object types

Fixes #13181

#12793 allowed different ordering of trait bounds in trait object types but failed to account for the ordering of projection bounds. I opted for sorting all the bounds at once rather than splitting them into `SmallVec`s so it's easier to do the same thing for other bounds when we have them.

22 months agoAuto merge of #13185 - ChayimFriedman2:insert-ws-in-static-const-macro, r=Veykril
bors [Mon, 5 Sep 2022 11:10:40 +0000 (11:10 +0000)]
Auto merge of #13185 - ChayimFriedman2:insert-ws-in-static-const-macro, r=Veykril

fix: Insert whitespaces into static & const bodies if they are expanded from macro on hover

Partially fixes #13143.

To resolve the other part we need to expand macros in unevaluated static & const bodies, and I'm not sure we want to. If for example it includes a call to `assert!()`, expanding it will lead to worse hover.

22 months agoAuto merge of #13139 - Austaras:enum, r=Veykril
bors [Mon, 5 Sep 2022 10:59:38 +0000 (10:59 +0000)]
Auto merge of #13139 - Austaras:enum, r=Veykril

Suggest struct when completing enum

closes #13107

22 months agoAuto merge of #13091 - ice1k:hey, r=Veykril
bors [Mon, 5 Sep 2022 10:49:19 +0000 (10:49 +0000)]
Auto merge of #13091 - ice1k:hey, r=Veykril

Remove type alias definition on inline

Fix #13079

22 months agofix: sort all bounds on trait object types
Ryo Yoshida [Mon, 5 Sep 2022 09:35:50 +0000 (18:35 +0900)]
fix: sort all bounds on trait object types

22 months agocomplete full struct in enum varaint
austaras [Fri, 2 Sep 2022 16:58:24 +0000 (00:58 +0800)]
complete full struct in enum varaint

22 months agoAuto merge of #13187 - matklad:return, r=Veykril
bors [Sun, 4 Sep 2022 18:25:55 +0000 (18:25 +0000)]
Auto merge of #13187 - matklad:return, r=Veykril

fix: correct broken logic for return complition

It seems that we've accidentally deleted the tests here couple of years
ago, and then fairly recently made a typo during refactor as well.

Reinstall tests, with coverage marks this time :-)

22 months agofix: correct broken logic for return complition
Aleksey Kladov [Sun, 4 Sep 2022 16:56:01 +0000 (17:56 +0100)]
fix: correct broken logic for return complition

It seems that we've accidentally deleted the tests here couple of years
ago, and then fairly recently made a typo during refactor as well.

Reinstall tests, with coverage marks this time :-)

22 months agoDo not insert a newline after `;` if the next token is a `}`
Chayim Refael Friedman [Sun, 4 Sep 2022 14:24:16 +0000 (14:24 +0000)]
Do not insert a newline after `;` if the next token is a `}`

This creates double newline.

22 months agoInsert whitespaces into static & const bodies if they are expanded from macro on...
Chayim Refael Friedman [Sun, 4 Sep 2022 13:26:00 +0000 (13:26 +0000)]
Insert whitespaces into static & const bodies if they are expanded from macro on hover

Macro expansion erases whitespace information, and so we end with invalid Rust code.

22 months agoAuto merge of #13183 - Veykril:break-break, r=Veykril
bors [Sat, 3 Sep 2022 15:33:21 +0000 (15:33 +0000)]
Auto merge of #13183 - Veykril:break-break, r=Veykril

Fix nested break expressions, expecting unknown types

22 months agoFix nested break expressions, expecting unknown types
Lukas Wirth [Sat, 3 Sep 2022 15:08:18 +0000 (17:08 +0200)]
Fix nested break expressions, expecting unknown types

23 months agoFmt
ice1000 [Fri, 2 Sep 2022 05:13:33 +0000 (05:13 +0000)]
Fmt

23 months agoFix test
ice1000 [Fri, 2 Sep 2022 05:13:02 +0000 (05:13 +0000)]
Fix test

23 months agoCreate `trait Removable`, replace `ted` APIs with builder APIs
ice1000 [Fri, 2 Sep 2022 05:06:51 +0000 (05:06 +0000)]
Create `trait Removable`, replace `ted` APIs with builder APIs

23 months agoAddress comments
ice1000 [Mon, 29 Aug 2022 20:27:53 +0000 (20:27 +0000)]
Address comments

23 months agoThis should work, but I got mysterious errors
ice1000 [Wed, 24 Aug 2022 05:49:59 +0000 (05:49 +0000)]
This should work, but I got mysterious errors

23 months agoExtract shared logic
ice1000 [Wed, 24 Aug 2022 04:50:12 +0000 (04:50 +0000)]
Extract shared logic

23 months agoRemove alias definition naively
ice1000 [Tue, 23 Aug 2022 04:59:41 +0000 (04:59 +0000)]
Remove alias definition naively

23 months agoAuto merge of #13175 - Veykril:resolver, r=Veykril
bors [Fri, 2 Sep 2022 17:38:26 +0000 (17:38 +0000)]
Auto merge of #13175 - Veykril:resolver, r=Veykril

Clarify the state of (extern) preludes for block def maps

23 months agoClarify the state of (extern) preludes for block def maps
Lukas Wirth [Fri, 2 Sep 2022 15:43:20 +0000 (17:43 +0200)]
Clarify the state of (extern) preludes for block def maps

23 months agoAuto merge of #13174 - Veykril:resolver, r=Veykril
bors [Fri, 2 Sep 2022 15:03:29 +0000 (15:03 +0000)]
Auto merge of #13174 - Veykril:resolver, r=Veykril

Lift out the module scope into a field in the Resolver

A Resolver *always* has a module scope at the end of its scope stack,
instead of encoding this as an invariant we can just lift this scope
out into a field, allowing us to skip going through the scope vec
indirection entirely.

23 months agoLift out the module scope into a field in the Resolver
Lukas Wirth [Fri, 2 Sep 2022 14:57:31 +0000 (16:57 +0200)]
Lift out the module scope into a field in the Resolver

A Resolver *always* has a module scope at the end of its scope stack,
instead of encoding this as an invariant we can just lift this scope
out into a field, allowing us to skip going through the scope vec
indirection entirely.

23 months agoAuto merge of #13173 - Veykril:synthetic, r=Veykril
bors [Fri, 2 Sep 2022 13:17:16 +0000 (13:17 +0000)]
Auto merge of #13173 - Veykril:synthetic, r=Veykril

Don't store SyntheticSyntax in the reverse maps in BodySourceMap

They are ZSTs which we can just create on missing access instead.

23 months agoDon't store SyntheticSyntax in the reverse maps in BodySourceMap
Lukas Wirth [Fri, 2 Sep 2022 13:08:48 +0000 (15:08 +0200)]
Don't store SyntheticSyntax in the reverse maps in BodySourceMap

They are ZSTs which we can just create on missing access instead.

23 months agoAuto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril
bors [Fri, 2 Sep 2022 12:32:36 +0000 (12:32 +0000)]
Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril

feat: Implement `feature(exhaustive_patterns)` from unstable Rust

Closes #12753

Recognize Rust's unstable `#![feature(exhaustive_patterns)]` (RFC 1872). Allow omitting visibly uninhabited variants from `match` expressions when the feature is on.

This adjusts match checking to the current implementation of the postponed RFC 1872 in rustc.

23 months agoAdd docs
iDawer [Fri, 2 Sep 2022 12:01:51 +0000 (17:01 +0500)]
Add docs

23 months agoRecord enabled unstable features into DefMap
iDawer [Fri, 2 Sep 2022 07:52:58 +0000 (12:52 +0500)]
Record enabled unstable features into DefMap

23 months agoAuto merge of #13171 - matklad:open-failure, r=lnicola
bors [Fri, 2 Sep 2022 10:53:49 +0000 (10:53 +0000)]
Auto merge of #13171 - matklad:open-failure, r=lnicola

internal: ignore failures when publishing to ovsx

This has been failing for a while

https://github.com/rust-lang/rust-analyzer/runs/8147683225?check_suite_focus=true#step:24:19

23 months agointernal: ignore failures when publishing to ovsx
Aleksey Kladov [Fri, 2 Sep 2022 10:48:58 +0000 (11:48 +0100)]
internal: ignore failures when publishing to ovsx

This has been failing for a while

https://github.com/rust-lang/rust-analyzer/runs/8147683225?check_suite_focus=true#step:24:19

23 months agoAuto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon...
bors [Thu, 1 Sep 2022 21:00:14 +0000 (21:00 +0000)]
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.

23 months agoAuto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink
bors [Thu, 1 Sep 2022 20:51:22 +0000 (20:51 +0000)]
Auto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink

fix: Lower float literals with underscores

Fixes #13155 (the problem was the `PI` is defined with `_f64` suffix). `PI` is still truncated, though, because `f64` cannot represent the value with full precision.

23 months agoAuto merge of #13165 - Veykril:breakables, r=Veykril
bors [Thu, 1 Sep 2022 13:07:26 +0000 (13:07 +0000)]
Auto merge of #13165 - Veykril:breakables, r=Veykril

Properly handle break resolution inside non-breakable expressions

We now diagnose invalid `continue` expressions and properly handle things like `async` blocks which prevent labels from resolving further. Cleaned this up since `label_break_value` is on the way to stabilization in rust (🎉 finally) and we weren't handling breaks for blocks properly yet.

23 months agoDon't run `rust-2021-compatibility` lints, our crates are already on 2021
Lukas Wirth [Thu, 1 Sep 2022 13:04:55 +0000 (15:04 +0200)]
Don't run `rust-2021-compatibility` lints, our crates are already on 2021

23 months agoProperly handle break resolution inside non-breakable expressions
Lukas Wirth [Thu, 1 Sep 2022 12:54:47 +0000 (14:54 +0200)]
Properly handle break resolution inside non-breakable expressions

23 months agoDiagnose incorrect continue expressions
Lukas Wirth [Thu, 1 Sep 2022 12:30:57 +0000 (14:30 +0200)]
Diagnose incorrect continue expressions

23 months agoSimplify breakables handling
Lukas Wirth [Thu, 1 Sep 2022 12:13:08 +0000 (14:13 +0200)]
Simplify breakables handling

23 months agoAuto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb
bors [Thu, 1 Sep 2022 00:26:53 +0000 (00:26 +0000)]
Auto merge of #100210 - mystor:proc_macro_diag_struct, r=eddyb

proc_macro/bridge: send diagnostics over the bridge as a struct

This removes some RPC when creating and emitting diagnostics, and
simplifies the bridge slightly.

After this change, there are no remaining methods which take advantage
of the support for `&mut` references to objects in the store as
arguments, meaning that support for them could technically be removed if
we wanted. The only remaining uses of immutable references into the
store are `TokenStream` and `SourceFile`.

r? `@eddyb`

23 months agoLower float literals with underscores
Chayim Refael Friedman [Thu, 1 Sep 2022 00:11:32 +0000 (00:11 +0000)]
Lower float literals with underscores

23 months agoParse TypePathFn with preceding `::`
Chayim Refael Friedman [Wed, 31 Aug 2022 23:19:09 +0000 (23:19 +0000)]
Parse TypePathFn with preceding `::`

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

23 months agoAuto merge of #13134 - Veykril:proc-highlight, r=Veykril
bors [Wed, 31 Aug 2022 19:42:53 +0000 (19:42 +0000)]
Auto merge of #13134 - Veykril:proc-highlight, r=Veykril

Highlight namerefs by syntax until proc-macros have been loaded

Usually when loading up a project, once loading is done we start answering highlight requests while proc-macros haven't always been loaded yet, so we start out with showing a lot of unresolved name-refs. After this PR, we'll use syntax based highlighting for those unresolved namerefs until the proc-macros have been loaded.

23 months agoCorrect visibility check
iDawer [Wed, 31 Aug 2022 16:41:24 +0000 (21:41 +0500)]
Correct visibility check

23 months agoAllow multi-part inlay hint labels with location links
Jonas Schievink [Wed, 31 Aug 2022 16:34:10 +0000 (18:34 +0200)]
Allow multi-part inlay hint labels with location links

23 months agoAuto merge of #13156 - Veykril:macro-stmts, r=Veykril
bors [Wed, 31 Aug 2022 16:09:17 +0000 (16:09 +0000)]
Auto merge of #13156 - Veykril:macro-stmts, r=Veykril

Remove hir::Expr::MacroStmts

This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.

23 months agoRemove unnecessary allocations
Lukas Wirth [Wed, 31 Aug 2022 16:05:52 +0000 (18:05 +0200)]
Remove unnecessary allocations

23 months agoImplement unstable RFC 1872 `exhaustive_patterns`
iDawer [Wed, 31 Aug 2022 15:17:54 +0000 (20:17 +0500)]
Implement unstable RFC 1872 `exhaustive_patterns`

23 months agoRemove hir::Expr::MacroStmts
Lukas Wirth [Wed, 31 Aug 2022 14:58:11 +0000 (16:58 +0200)]
Remove hir::Expr::MacroStmts

This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.

23 months agoAuto merge of #13120 - Austaras:master, r=jonas-schievink
bors [Wed, 31 Aug 2022 13:55:29 +0000 (13:55 +0000)]
Auto merge of #13120 - Austaras:master, r=jonas-schievink

turn `unwrap_or` into `unwrap_or_else` and vice versa

closes #12983

23 months agoAuto merge of #13005 - pocket7878:convert-two-arm-bool-match-to-matches-macro, r...
bors [Wed, 31 Aug 2022 13:47:40 +0000 (13:47 +0000)]
Auto merge of #13005 - pocket7878:convert-two-arm-bool-match-to-matches-macro, r=jonas-schievink

feature: Assist to turn match into matches! invocation

Resolves #12510

This PR adds an assist, which convert 2-arm match that evaluates to a boolean into the equivalent matches! invocation.

23 months agoAuto merge of #13051 - DropDemBits:attrs-and-comments-on-enum-variant, r=jonas-schievink
bors [Wed, 31 Aug 2022 13:34:43 +0000 (13:34 +0000)]
Auto merge of #13051 - DropDemBits:attrs-and-comments-on-enum-variant, r=jonas-schievink

fix: Only move comments when extracting a struct from an enum variant

Motivating example:

```rs
#[derive(Debug, thiserror::Error)]
enum Error {
    /// Some explanation for this error
    #[error("message")]
    $0Woops {
        code: u32
    }
}
```
now becomes
```rs
/// Some explanation for this error
#[derive(Debug, thiserror::Error)]
struct Woops{
    code: u32
}

#[derive(Debug, thiserror::Error)]
enum Error {
    #[error("message")]
    Woops(Woops)
}
```
(the `thiserror::Error` derive being copied and the struct formatting aren't ideal, though those are issues for another day)

23 months agofeature: Check if first_arm bool and second_arm bool is inverted or not.
Pocket7878 [Wed, 31 Aug 2022 09:38:20 +0000 (18:38 +0900)]
feature: Check if first_arm bool and second_arm bool is inverted or not.

23 months agofeature: Simplfy branch check logics
Masato Sogame [Wed, 31 Aug 2022 09:29:58 +0000 (18:29 +0900)]
feature: Simplfy branch check logics

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
23 months agofix: Simplify logics to allow two-arm enum match.
Pocket7878 [Fri, 12 Aug 2022 15:29:18 +0000 (00:29 +0900)]
fix: Simplify logics to allow two-arm enum match.

23 months agoAdd convert_two_arm_bool_match_to_matches_macro ide-assists
Pocket7878 [Fri, 12 Aug 2022 07:11:04 +0000 (16:11 +0900)]
Add convert_two_arm_bool_match_to_matches_macro ide-assists

23 months agochange title
austaras [Wed, 31 Aug 2022 09:31:23 +0000 (17:31 +0800)]
change title

23 months agoAuto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril
bors [Wed, 31 Aug 2022 08:37:14 +0000 (08:37 +0000)]
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`)

23 months agoAuto merge of #12793 - lowr:fix/12739, r=Veykril
bors [Wed, 31 Aug 2022 08:28:12 +0000 (08:28 +0000)]
Auto merge of #12793 - lowr:fix/12739, r=Veykril

fix: sort and deduplicate auto traits in trait object types

Fixes #12739

Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like [`rustc`](https://github.com/rust-lang/rust/blob/880416180b0a9ee1141c07d4d17667edb77daebd/compiler/rustc_typeck/src/astconv/mod.rs#L1487-L1488) and [`chalk-integration`](https://github.com/rust-lang/chalk/blob/master/chalk-integration/src/lowering.rs#L575) do.

Quoting from [the Chalk book](https://rust-lang.github.io/chalk/book/types/rust_types.html#dyn-types):

> Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a `dyn Foo + Send` and a `dyn Send + Foo`, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.

Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.

23 months agoAuto merge of #13149 - lowr:fix/unescape-raw-ident-module-path, r=Veykril
bors [Wed, 31 Aug 2022 08:15:31 +0000 (08:15 +0000)]
Auto merge of #13149 - lowr:fix/unescape-raw-ident-module-path, r=Veykril

fix: unescape all occurrences of module name in module resolution

Fixes #13141

23 months agoAuto merge of #13154 - Veykril:ty-mac-expander, r=Veykril
bors [Wed, 31 Aug 2022 08:07:26 +0000 (08:07 +0000)]
Auto merge of #13154 - Veykril:ty-mac-expander, r=Veykril

Drop the expander borrow in all control flow paths

The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.

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

23 months agoDrop the expander borrow in all control flow paths
Lukas Wirth [Wed, 31 Aug 2022 08:04:01 +0000 (10:04 +0200)]
Drop the expander borrow in all control flow paths

The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.

23 months agoAuto merge of #13151 - ChayimFriedman2:replace-turbofish-other-type, r=Veykril
bors [Wed, 31 Aug 2022 07:47:53 +0000 (07:47 +0000)]
Auto merge of #13151 - ChayimFriedman2:replace-turbofish-other-type, r=Veykril

Use correct type in "Replace turbofish with type"

And support `?` and `.await` expressions.

Fixes #13148.

The assist can still show up even if the turbofish's type is not used at all, e.g.:
```rust
fn foo<T>() {}
let v = foo::<i32>();
```

23 months agoSupport `?` and `.await` in "Replace turbofish with explicit type"
Chayim Refael Friedman [Wed, 31 Aug 2022 01:24:36 +0000 (01:24 +0000)]
Support `?` and `.await` in "Replace turbofish with explicit type"

Now that we use type information this is easy.

23 months agoUse type information to deduce the correct type for "Replace turbofish with explicit...
Chayim Refael Friedman [Wed, 31 Aug 2022 01:07:41 +0000 (01:07 +0000)]
Use type information to deduce the correct type for "Replace turbofish with explicit type", even when it is not exactly the same as the turbofish type

I implemented that by checking the expressions' type.
This could probably be implemented better by taking the function's return type and substituting the generic parameter with the provided turbofish, but this is more complicated.

23 months agofix: unescape all occurrences of module name in module resolution
Ryo Yoshida [Tue, 30 Aug 2022 18:43:28 +0000 (03:43 +0900)]
fix: unescape all occurrences of module name in module resolution

23 months agoMove comments to the extracted struct
DropDemBits [Tue, 30 Aug 2022 18:47:08 +0000 (14:47 -0400)]
Move comments to the extracted struct

23 months agoAuto merge of #13145 - ChayimFriedman2:unmerge-match-arm, r=jonas-schievink
bors [Tue, 30 Aug 2022 13:31:37 +0000 (13:31 +0000)]
Auto merge of #13145 - ChayimFriedman2:unmerge-match-arm, r=jonas-schievink

feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions

Fixes #13072.

The way I implemented it it leaves the `OrPat` in place even if there is only one pattern now but I don't think something will break because of that, and when more code will be typed we'll parse it again anyway. Removing it (but keeping the child pattern) is hard, I don't know how to do that.

23 months agofix: sort and deduplicate auto traits in trait object types
Ryo Yoshida [Mon, 18 Jul 2022 10:49:14 +0000 (19:49 +0900)]
fix: sort and deduplicate auto traits in trait object types

23 months ago:arrow_up: rust-analyzer
Laurențiu Nicola [Tue, 30 Aug 2022 11:51:24 +0000 (14:51 +0300)]
:arrow_up: rust-analyzer

23 months agofeat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions
Chayim Refael Friedman [Tue, 30 Aug 2022 09:42:12 +0000 (09:42 +0000)]
feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions