Commit Graph

16585 Commits

Author SHA1 Message Date
Ayomide Bamidele
391be07298 Folding range for consts 2021-03-29 12:17:19 +01:00
Ayomide Bamidele
23601454fe New FoldKinds - Consts, Statics 2021-03-29 11:49:14 +01:00
Ayomide Bamidele
f6702dda9a Test cases for folding consts and statics 2021-03-29 11:43:03 +01:00
bors[bot]
ae7de296ae
Merge #8222
8222: Don't mark unlinked file diagnostic as unused r=lnicola a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8215, at least on VS Code

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-29 07:30:28 +00:00
bors[bot]
bb1d925dab
Merge #8212
8212: Basic support macro 2.0 r=jonas-schievink a=edwin0cheng

Turn out it is quite straight forward :)

r @jonas-schievink 

![m2](https://user-images.githubusercontent.com/11014119/112712565-6eb99380-8f0b-11eb-88de-5d7f974dfe6d.png)


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-28 15:43:11 +00:00
Edwin Cheng
7729879118 Remove unused test fixtures 2021-03-28 10:41:18 +08:00
Jonas Schievink
bd18e5fa87 Don't mark unlinked file diagnostic as unused 2021-03-28 03:56:03 +02:00
bors[bot]
ce6bb5ccca
Merge #8221
8221: Prefer adding `mod` declaration to lib.rs over file.rs in UnlinkedFile fix r=Veykril a=Veykril

When there is a `lib.rs` and `main.rs` in one crate, one usually wants the `lib.rs` file to declare the modules.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-27 22:43:34 +00:00
Lukas Wirth
c9e479870b Prefer add mod declaration to lib.rs over file.rs in UnlinkedFile fix 2021-03-27 23:43:07 +01:00
bors[bot]
84f1660a37
Merge #8220
8220: Reorder some ide_db imports r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-27 21:13:08 +00:00
Lukas Wirth
1ef55002c2 Cleanup ide_db imports 2021-03-27 21:51:00 +01:00
Jonas Schievink
e6580aa380 Use const instead of let 2021-03-27 19:02:08 +01:00
Jonas Schievink
b494e47920 Snippet support in extract_type_alias 2021-03-27 18:53:13 +01:00
Jonas Schievink
201fbac8a9 Fix handling of multi-cursor snippets
This allows one snippet per TextEdit, multiple in the same TextEdit
are still broken
2021-03-27 18:50:55 +01:00
ivan770
665266bf66
Replace empty dbg with unit in letexprs, better removal in blocks 2021-03-27 17:34:35 +02:00
bors[bot]
97dbbad482
Merge #8214
8214: Mention the rustup version in the manual r=lnicola a=lnicola

Closes #7860

bors r+

changelog fix mention the `rustup` version in the installation instructions.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-27 10:40:25 +00:00
Laurențiu Nicola
ea8159893a Mention the rustup version in the manual 2021-03-27 12:39:16 +02:00
bors[bot]
ae92014319
Merge #8213
8213: Added support for const generics in impl generation r=Veykril a=ivan770

Closes #8211

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-27 10:00:37 +00:00
ivan770
5a2ef8d0ca
Added support for const generics in impl generation 2021-03-27 11:37:39 +02:00
ivan770
0a5badbcba
Replace match on option with if 2021-03-27 11:17:17 +02:00
ivan770
c7cd0aff4a
Remove dbg expression and newline as whole 2021-03-27 11:10:20 +02:00
Edwin Cheng
eedadd7024 Add support for doc on hover for macro 2.0 2021-03-27 14:57:11 +08:00
Edwin Cheng
4520002b63 Unleash macro 2.0 in hightlight and more 2021-03-27 14:42:49 +08:00
Edwin Cheng
a193666361 Basic Support Macro 2.0 2021-03-27 13:44:54 +08:00
bors[bot]
c8066ebd17
Merge #8201
8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng

This PR attempts to properly handle macro statement expansion by implementing the following:

1.  Merge macro expanded statements to parent scope statements.
2.  Add a new hir `Expr::MacroStmts` for handle tail expression infer.

PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :(

Fixes  #8171



Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2021-03-27 02:57:02 +00:00
bors[bot]
9c9376c4cf
Merge #8209
8209: Add TokenText r=lnicola a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-26 19:33:54 +00:00
Jonas Schievink
e39979aa91 Implement "Extract type alias" assist 2021-03-26 19:39:20 +01:00
Aleksey Kladov
1bbac9053d Add TokenText 2021-03-26 21:33:45 +03:00
bors[bot]
77a447dcda
Merge #8191
8191: syntax: return owned string instead of leaking string r=cynecx a=cynecx

Quick hack? to alleviate https://github.com/rust-analyzer/rust-analyzer/issues/8181#issuecomment-806019126. I haven't run any tests but this should affect performance since we are deallocating more.

r? @matklad 

Co-authored-by: cynecx <me@cynecx.net>
2021-03-26 17:59:06 +00:00
cynecx
5ff3299dd6 syntax: return owned string instead of leaking string 2021-03-26 18:30:59 +01:00
bors[bot]
4ecaad98e0
Merge #8056
8056: completion relevance consider if types can be unified r=JoshMcguigan a=JoshMcguigan

This PR improves completion relevance scoring for generic types, in cases where the types could unify. 

### Before

![pre-could-unify](https://user-images.githubusercontent.com/22216761/111338556-46d94e80-8634-11eb-9936-2b20eb9e6756.png)

### After

![post-could-unify](https://user-images.githubusercontent.com/22216761/111338598-4e005c80-8634-11eb-92e0-69c2c1cda6fc.png)

changelog feature improve completions

Co-authored-by: Josh Mcguigan <joshmcg88@gmail.com>
2021-03-26 16:29:20 +00:00
Josh Mcguigan
0e31ae2cef completion relevance distinguish between exact type match and could unify 2021-03-26 09:18:18 -07:00
Josh Mcguigan
957939292e completion relevance consider if types can be unified 2021-03-26 09:11:50 -07:00
bors[bot]
20e32fc946
Merge #8206
8206: Ignore main functions not in root module r=Veykril a=ivan770

Closes #8195

Co-authored-by: ivan770 <leshenko.ivan770@gmail.com>
2021-03-26 15:00:58 +00:00
ivan770
2292ff64f1
Show dbg remove assist on empty contents 2021-03-26 16:15:26 +02:00
ivan770
50e28aec25
Ignore main functions not in root module 2021-03-26 16:04:53 +02:00
Edwin Cheng
8ce15b02de Fix recursive macro statement expansion 2021-03-26 04:21:15 +08:00
bors[bot]
4cb3ecce3f
Merge #8200
8200: Use arrayvec 0.6 r=kjeremy a=lnicola

Closes #8198

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-25 19:09:13 +00:00
Laurențiu Nicola
bc5c86543b Use more std::array::IntoIter 2021-03-25 21:06:48 +02:00
Laurențiu Nicola
9787bddac5 Use arrayvec 0.6 2021-03-25 21:03:20 +02:00
bors[bot]
59fdd7c84c
Merge #8197
8197: Rust 1.51 r=lnicola a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-03-25 15:35:36 +00:00
kjeremy
bdee55d66b Rust 1.51 2021-03-25 11:34:13 -04:00
bors[bot]
f6f582dec4
Merge #8193
8193: Fix manual description for rust_project.json r=Veykril a=tweksteen



Co-authored-by: Thiébaud Weksteen <tweek@google.com>
2021-03-25 10:33:05 +00:00
bors[bot]
5b8a087fc2
Merge #8194
8194: Make a full clone in `release.yaml` to bring in tags r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-25 10:18:44 +00:00
Laurențiu Nicola
27bfb1fa5c Make a full clone in release.yaml 2021-03-25 12:17:48 +02:00
Thiébaud Weksteen
1c68954a7d Fix manual description for rust_project.json 2021-03-25 10:02:16 +01:00
bors[bot]
d7db38fff9
Merge #7907
7907: Autoderef with visibility r=cynecx a=cynecx

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7841.

I am not sure about the general approach here. Right now this simply tries to check whether the autoderef candidate is reachable from the current module. ~~However this doesn't exactly work with traits (see the `tests::macros::infer_derive_clone_in_core` test, which fails right now).~~ see comment below

Refs:

- `rustc_typeck` checking fields: 66ec64ccf3/compiler/rustc_typeck/src/check/expr.rs (L1610) 


r? @flodiebold

Co-authored-by: cynecx <me@cynecx.net>
2021-03-24 22:37:48 +00:00
bors[bot]
9d81618f11
Merge #8190
8190: Fix chalk_ir assertion r=flodiebold a=flodiebold

Fixes #8150.

I implemented a validator that catches this in the tests, but it'd need to get merged in Chalk first.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-24 22:13:56 +00:00
Florian Diebold
b4c20e3589 Fix chalk_ir assertion
Fixes #8150.
2021-03-24 23:10:13 +01:00
cynecx
d1156bb52e hir: don't use the self module as visible_from in iterate_method_candidates 2021-03-24 23:09:22 +01:00