]>
git.lizzy.rs Git - rust.git/log
Lukas Wirth [Wed, 2 Jun 2021 20:10:09 +0000 (22:10 +0200)]
Document that `addCallArgumentSnippets` requires `addCallParenthesis
bors[bot] [Wed, 2 Jun 2021 17:25:11 +0000 (17:25 +0000)]
Merge #9108
9108: Don't show extract into variable assist for unit expressions r=jonas-schievink a=brandondong
**Reproduction:**
```rust
fn main() {
let mut i = 3;
$0if i >= 0 {
i += 1;
} else {
i -= 1;
}$0
}
```
1. Select the snippet of code between the $0's.
2. The extract into variable assist shows up, pushing down the more useful extract into function assist.
3. The resulting output of selecting the extract into variable assist is valid but with the extracted variable having the unit type:
```rust
fn main() {
let mut i = 3;
let var_name = if i >= 0 {
i += 1;
} else {
i -= 1;
};
var_name
}
```
**Fix:**
- Don't show the extract into variable assist for unit expressions. I could not think of any scenarios where such a variable extraction would be desired.
Co-authored-by: Brandon <brandondong604@hotmail.com>
bors[bot] [Wed, 2 Jun 2021 16:18:42 +0000 (16:18 +0000)]
Merge #9112
9112: Fix some bugs in `extract_struct_from_enum_variant` assist r=Veykril a=Veykril
bors r+
Fixes #9100
Fixes #9099
Kind of fixes #9109, it now copies all the generics might be incorrect if the variant doesn't use all of them)
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 2 Jun 2021 16:16:59 +0000 (18:16 +0200)]
Fix references to patterns in extract_struct_from_enum_variant assist
Lukas Wirth [Wed, 2 Jun 2021 15:54:57 +0000 (17:54 +0200)]
Carry over attributes in extract_struct_from_enum_variant
Lukas Wirth [Wed, 2 Jun 2021 15:44:00 +0000 (17:44 +0200)]
Account for generics in extract_struct_from_enum_variant
bors[bot] [Wed, 2 Jun 2021 15:21:17 +0000 (15:21 +0000)]
Merge #9111
9111: fix: make "extract type alias" place extracted type alias outside of impl r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
bors[bot] [Wed, 2 Jun 2021 15:14:06 +0000 (15:14 +0000)]
Merge #9110
9110: internal: simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 2 Jun 2021 13:25:02 +0000 (15:25 +0200)]
Remove obsolete is_new_item field on CompletionContext
Jonas Schievink [Wed, 2 Jun 2021 14:50:44 +0000 (16:50 +0200)]
Place extracted type alias outside of impl
Lukas Wirth [Wed, 2 Jun 2021 13:21:18 +0000 (15:21 +0200)]
Add MethodCall and FieldAccess variants to ImmediateLocation
Brandon [Wed, 2 Jun 2021 06:49:31 +0000 (23:49 -0700)]
Don't show extract into variable assist for unit expressions
bors[bot] [Tue, 1 Jun 2021 17:03:54 +0000 (17:03 +0000)]
Merge #9102
9102: minor: Fall back to legacy prelude r=jonas-schievink a=jonas-schievink
should fix https://github.com/rust-analyzer/rust-analyzer/issues/9101
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Tue, 1 Jun 2021 17:03:00 +0000 (19:03 +0200)]
Fall back to legacy prelude
bors[bot] [Tue, 1 Jun 2021 11:46:59 +0000 (11:46 +0000)]
Merge #9097
9097: feat: Implement per-edition preludes r=jonas-schievink a=jonas-schievink
Part of https://github.com/rust-analyzer/rust-analyzer/issues/9056
Our previous implementation was incorrect (presumably because of the misleading comment in libstd [here](https://github.com/rust-lang/rust/blob/
a7890c7952bdc9445eb6c63dc671fa7a1ab0260d /library/std/src/lib.rs#L339-L343)). `#[prelude_import]` does not define the prelude, it can only override the implicit prelude for the current crate.
This PR fixes that, which also makes the prelude imports in `rustc_span` work. Closes https://github.com/rust-analyzer/rust-analyzer/issues/8815.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Tue, 1 Jun 2021 11:39:19 +0000 (13:39 +0200)]
Implement per-edition preludes
bors[bot] [Mon, 31 May 2021 21:01:52 +0000 (21:01 +0000)]
Merge #8717
8717: Update match checking algorithm r=iDawer a=iDawer
I've recently got interest in the match checking to extend the current algo to support reporting witnesses of non-exhaustiveness.
It appears the algo is outdated from rustc's implementation. I decided to rewrite it based on the latest rustc's version. It is a diff-based port to ra codebase. That means you can diff-compare these files to rustc.
I'm striving to keep minimal ra-related changes in the algo to make it easier to backport future changes from the upstream.
Based on upstream algorithm of version rust-lang/rust 1.52.0-nightly (
25c15cdbe 2021-04-22)
https://github.com/rust-lang/rust/blob/
25c15cdbe /compiler/rustc_mir_build/src/thir/pattern/usefulness.rs
The goal of this PR is to cover the current `missing-match-arm` diagnostic.
What is remaining to do:
- [x] Error handling. The errors that are unrelated to match checking will be handled before the check. Just like how it made in rustc.
- [x] Lowering `hir_def::expr::Pat` to `hir_ty::diagnostics::match_check::Pat`. rustc's match checking works on top of `rustc_mir_build::thir::Pat`, which is lowered from `hir::Pat` and carries some extra semantics used by the check. All unrelated checks are done there. RA could use this to rule out running the check on unimplemented cases (`Pat::ConstBlock`, etc).
- [x] ~~Proper~~Loose typecheck of match arm patterns (https://github.com/rust-analyzer/rust-analyzer/pull/8840, https://github.com/rust-analyzer/rust-analyzer/pull/8875).
- [x] Tests from `hir_ty::diagnostics::match_check::tests`.
- [x] Clean up `todo`s
- [x] Test run on real repos https://github.com/rust-analyzer/rust-analyzer/pull/8717#issuecomment-
847120265 .
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
Dawer [Mon, 31 May 2021 20:44:51 +0000 (01:44 +0500)]
Expand fixme comments
Dawer [Mon, 24 May 2021 12:03:36 +0000 (17:03 +0500)]
fix: panic on extra fields in a pattern
Dawer [Sat, 22 May 2021 07:36:48 +0000 (12:36 +0500)]
Correct binding pattern's type; handle invalid records.
Dawer [Wed, 19 May 2021 13:08:13 +0000 (18:08 +0500)]
Take substitutions into account.
Dawer [Wed, 19 May 2021 13:00:25 +0000 (18:00 +0500)]
eprint panic context
Dawer [Sun, 16 May 2021 13:11:45 +0000 (18:11 +0500)]
minor: doc comment pat_util
Dawer [Wed, 12 May 2021 07:50:22 +0000 (12:50 +0500)]
Test match guards, reference patterns
Dawer [Wed, 12 May 2021 06:04:56 +0000 (11:04 +0500)]
Box field detection; test #[non-exhaustive] attribute
Dawer [Tue, 11 May 2021 13:24:39 +0000 (18:24 +0500)]
Better tests: check if match checking bails out.
Dawer [Tue, 11 May 2021 12:18:16 +0000 (17:18 +0500)]
Replace the old match checking algorithm
Dawer [Tue, 11 May 2021 11:15:35 +0000 (16:15 +0500)]
Include old tests
Dawer [Mon, 10 May 2021 17:40:35 +0000 (22:40 +0500)]
Don't panic on a pattern of unresolved ADT variant.
Dawer [Mon, 10 May 2021 11:55:00 +0000 (16:55 +0500)]
Clean up, more docs.
Dawer [Mon, 10 May 2021 08:22:13 +0000 (13:22 +0500)]
Check pattern types.
Dawer [Sat, 8 May 2021 18:06:17 +0000 (23:06 +0500)]
Expand binding patterns.
Dawer [Fri, 7 May 2021 07:20:23 +0000 (12:20 +0500)]
Fix visibility warnings
Dawer [Fri, 7 May 2021 05:38:51 +0000 (10:38 +0500)]
Lower binding pattern
Dawer [Thu, 6 May 2021 14:39:27 +0000 (19:39 +0500)]
Lower bool literals
Dawer [Thu, 6 May 2021 12:26:05 +0000 (17:26 +0500)]
Treat ctor of unhandled type as non-exhaustive.
Dawer [Thu, 6 May 2021 12:18:51 +0000 (17:18 +0500)]
Lower Pat::Path
Dawer [Thu, 6 May 2021 08:32:35 +0000 (13:32 +0500)]
Do not do match check if lowering failed.
Dawer [Thu, 6 May 2021 08:15:40 +0000 (13:15 +0500)]
Fix panics on pattern_arena.borrow with ugly cloning
Dawer [Thu, 6 May 2021 04:42:00 +0000 (09:42 +0500)]
Basic lowering hir_def::exrp::Pat -> typed HIR.
Pattern arena is broken
Dawer [Sun, 2 May 2021 19:09:21 +0000 (00:09 +0500)]
Handle unordered fields in struct patterns
Dawer [Sun, 2 May 2021 15:56:54 +0000 (20:56 +0500)]
Complete field replacing
Dawer [Sun, 2 May 2021 15:09:31 +0000 (20:09 +0500)]
Support bool literal patterns
Dawer [Fri, 30 Apr 2021 14:12:04 +0000 (19:12 +0500)]
Check enum patterns
Dawer [Fri, 30 Apr 2021 08:33:07 +0000 (13:33 +0500)]
Build wildcard witnesses instead of panicking
Dawer [Thu, 29 Apr 2021 18:28:43 +0000 (23:28 +0500)]
Implement struct ctor application
Dawer [Thu, 29 Apr 2021 09:19:01 +0000 (14:19 +0500)]
Add remaining Constructor variants
Dawer [Thu, 29 Apr 2021 07:08:52 +0000 (12:08 +0500)]
Complete usefulness::SubPatSet impl
Dawer [Thu, 29 Apr 2021 06:33:45 +0000 (11:33 +0500)]
List useless patterns in a useful match arm
Dawer [Thu, 29 Apr 2021 05:04:24 +0000 (10:04 +0500)]
Remove unneeded indirection on PatCtxt
Dawer [Wed, 28 Apr 2021 18:25:01 +0000 (23:25 +0500)]
Enable generation of non-exhaustiveness witnesses
Dawer [Thu, 22 Apr 2021 15:17:27 +0000 (20:17 +0500)]
Update match checking.
fn is_useful , more skeletons
Specify a lifetime on pattern references
impl PatStack
fill impl Matrix
PatStack::pop_head_constructor
Index-based approach
struct PatCtxt
fields construction fn Fields::wildcards
split wildcard
fn Constructor::is_covered_by_any(..)
fn Matrix::specialize_constructor(..)
impl Usefulness
Initial work on witness construction
Reorganize files
Replace match checking diagnostic
Handle types of expanded patterns
unit match checking go brrr
bors[bot] [Mon, 31 May 2021 18:47:00 +0000 (18:47 +0000)]
Merge #9090
9090: hir_ty: use correct receiver_ty in method resolution r=cynecx a=cynecx
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8100.
Co-authored-by: cynecx <me@cynecx.net>
bors[bot] [Mon, 31 May 2021 18:38:15 +0000 (18:38 +0000)]
Merge #9091
9091: Fix opening single files r=SomeoneToIgnore a=SomeoneToIgnore
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9082
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Kirill Bulatov [Mon, 31 May 2021 18:37:08 +0000 (21:37 +0300)]
Fix opening single files
cynecx [Mon, 31 May 2021 18:04:18 +0000 (20:04 +0200)]
hir_ty: use correct receiver_ty in method resolution
bors[bot] [Mon, 31 May 2021 17:22:09 +0000 (17:22 +0000)]
Merge #9088
9088: minor: remove debug print r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 31 May 2021 17:20:30 +0000 (20:20 +0300)]
minor: remove debug print
bors[bot] [Mon, 31 May 2021 17:12:01 +0000 (17:12 +0000)]
Merge #9084 #9087
9084: fix: avoid panics in match case diagnostic r=matklad a=matklad
bors r+
🤖
closes #8809
9087: fix: fix shell injection in task spawning r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 31 May 2021 16:51:19 +0000 (19:51 +0300)]
fix: fix shell injection in task spawning
closes #9058
bors[bot] [Mon, 31 May 2021 16:59:29 +0000 (16:59 +0000)]
Merge #9086
9086: minor: try fixing proc_macro_srv tests r=jonas-schievink a=jonas-schievink
Not entirely sure what's going wrong in https://github.com/rust-analyzer/rust-analyzer/pull/9084, but this might fix it?
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Mon, 31 May 2021 16:58:36 +0000 (18:58 +0200)]
Use `cargo check` again
Aleksey Kladov [Mon, 31 May 2021 16:09:44 +0000 (19:09 +0300)]
minor: it's Parameter, not Argument
Aleksey Kladov [Mon, 31 May 2021 16:06:40 +0000 (19:06 +0300)]
fix: avoid panics in match case diagnostic
bors[bot] [Mon, 31 May 2021 15:48:41 +0000 (15:48 +0000)]
Merge #8952
8952: add support of impl block for doctest into runnables r=matklad a=bnjjj
close #6356
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
bors[bot] [Mon, 31 May 2021 15:34:04 +0000 (15:34 +0000)]
Merge #9083
9083: internal: Simplify proc_macro_srv tests r=jonas-schievink a=jonas-schievink
Removes `serde_derive`, instead using `proc_macro_test` macros.
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/9067
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Mon, 31 May 2021 15:32:56 +0000 (17:32 +0200)]
Simplify proc_macro_srv tests
bors[bot] [Mon, 31 May 2021 14:28:03 +0000 (14:28 +0000)]
Merge #9081
9081: minor: expand docs a tiny bit r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Mon, 31 May 2021 14:27:27 +0000 (17:27 +0300)]
minor: expand docs a tiny bit
bors[bot] [Mon, 31 May 2021 13:38:32 +0000 (13:38 +0000)]
Merge #9079
9079: Don't take the parent kind of trailing attributes in attr completion r=Veykril a=Veykril
bors r+
fixes https://github.com/rust-analyzer/rust-analyzer/issues/9076
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Mon, 31 May 2021 13:35:22 +0000 (15:35 +0200)]
Don't take the parent kind of trailing attributes in attr completion
bors[bot] [Mon, 31 May 2021 13:21:31 +0000 (13:21 +0000)]
Merge #9039
9039: feat: Complete fields and methods with `self.` prefixed when inside methods r=matklad a=Veykril
![w65NbjkZiG](https://user-images.githubusercontent.com/
3757771 /
119984385 -
a0111700 -bfc1-11eb-9dbf-
52fdaa4d72b5 .gif)
Closes #7173
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 30 May 2021 14:41:33 +0000 (16:41 +0200)]
Add config setting for self-on-the-fly
Lukas Wirth [Fri, 28 May 2021 13:09:10 +0000 (15:09 +0200)]
Move unprefixed field/method completion to `dot`
Lukas Wirth [Fri, 28 May 2021 12:38:09 +0000 (14:38 +0200)]
Less strings, more hir::Names
Lukas Wirth [Fri, 28 May 2021 12:02:53 +0000 (14:02 +0200)]
Complete `self.` prefixed fields and methods inside methods
bors[bot] [Mon, 31 May 2021 12:42:32 +0000 (12:42 +0000)]
Merge #8866
8866: Update salsa r=matklad a=jonas-schievink
This updates salsa to include https://github.com/salsa-rs/salsa/pull/265, and removes all cancellation-related code from rust-analyzer
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
bors[bot] [Mon, 31 May 2021 12:34:01 +0000 (12:34 +0000)]
Merge #9060
9060: feat: Diagnose unimplemented built-in macros r=matklad a=jonas-schievink
A number of built-in attribute macros are unsupported, I thought it might be useful to put a diagnostic on their definition in libcore. Not sure.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
bors[bot] [Mon, 31 May 2021 12:16:44 +0000 (12:16 +0000)]
Merge #9077
9077: internal: Use `Name`s instead of Strings in the completion rendering api r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Mon, 31 May 2021 12:13:09 +0000 (14:13 +0200)]
Use `Name`s instead of Strings in the completion rendering api
bors[bot] [Mon, 31 May 2021 08:20:28 +0000 (08:20 +0000)]
Merge #9025
9025: internal: Display unknown types in `analysis-stats` r=flodiebold a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
bors[bot] [Mon, 31 May 2021 07:20:18 +0000 (07:20 +0000)]
Merge #9072
9072: minor: reenable incremental test builds r=lnicola a=iDawer
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
Dawer [Mon, 31 May 2021 07:15:40 +0000 (12:15 +0500)]
minor: reenable incremental test builds
bors[bot] [Sun, 30 May 2021 23:52:53 +0000 (23:52 +0000)]
Merge #9071
9071: minor: reenable incremental release builds r=jonas-schievink a=jonas-schievink
forgot to turn this back on in https://github.com/rust-analyzer/rust-analyzer/pull/9069
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 30 May 2021 23:12:11 +0000 (01:12 +0200)]
reenable incremental release builds
bors[bot] [Sun, 30 May 2021 21:48:43 +0000 (21:48 +0000)]
Merge #9069
9069: minor: Don't force-disable incremental r=jonas-schievink a=jonas-schievink
1.52.1 turns incremental off regardless of this setting, so this is unnecessary. Removing this allow manually overriding Cargo to enable incremental.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sun, 30 May 2021 21:46:39 +0000 (23:46 +0200)]
Don't force-disable incremental
bors[bot] [Sun, 30 May 2021 19:37:29 +0000 (19:37 +0000)]
Merge #9068
9068: Move more `CompletinoContext` fields to `ImmediateLocation` r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 30 May 2021 19:23:42 +0000 (21:23 +0200)]
Move more fields to `ImmediateLocation`
bors[bot] [Sun, 30 May 2021 17:28:52 +0000 (17:28 +0000)]
Merge #9065
9065: hir_ty: don't pass where clauses of associated types down to chalk r=cynecx a=cynecx
See #9052.
Co-authored-by: cynecx <me@cynecx.net>
cynecx [Sun, 30 May 2021 16:37:02 +0000 (18:37 +0200)]
hir_ty: don't pass where clauses of associated types down to chalk (temp. fix #9052)
bors[bot] [Sun, 30 May 2021 15:13:29 +0000 (15:13 +0000)]
Merge #9064
9064: Fix incorrect prefer_inner calls on some attribute completions r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 30 May 2021 15:10:42 +0000 (17:10 +0200)]
Fix incorrect prefer_inner calls on some attribute completions
bors[bot] [Sun, 30 May 2021 11:48:59 +0000 (11:48 +0000)]
Merge #9062
9062: internal: Bump deps r=lnicola a=lnicola
Fixes #9061
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Sun, 30 May 2021 11:48:10 +0000 (14:48 +0300)]
Bump deps
Jonas Schievink [Sun, 30 May 2021 02:19:47 +0000 (04:19 +0200)]
Diagnose unimplemented built-in macros
bors[bot] [Sat, 29 May 2021 19:19:24 +0000 (19:19 +0000)]
Merge #9059
9059: fix: Only complete derive proc macros in `#[derive]` r=jonas-schievink a=jonas-schievink
HIR now gives them `MacroKind::Derive` instead of `MacroKind::ProcMacro`
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
Jonas Schievink [Sat, 29 May 2021 19:18:14 +0000 (21:18 +0200)]
Only complete derive proc macros in `#[derive]`
Jonas Schievink [Sat, 29 May 2021 19:10:00 +0000 (21:10 +0200)]
Update to prerelease
bors[bot] [Sat, 29 May 2021 18:33:49 +0000 (18:33 +0000)]
Merge #9057
9057: internal: Thread proc-macro types through the HIR r=jonas-schievink a=jonas-schievink
Should help with completion of derives. cc @Veykril
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>