Commit graph

6854 commits

Author SHA1 Message Date
Veetaha
667d224fcc Reduce the usage of bare subscript operator 2020-06-14 13:12:52 +03:00
bors[bot]
246c66a7f7
Merge #4867
4867: Cleanup URL handling r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:35:44 +00:00
Aleksey Kladov
50bbf7233d Cleanup URL handling 2020-06-13 14:15:38 +02:00
bors[bot]
d00ca86da4
Merge #4868
4868: Fix if and while postfix completions r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:12:08 +00:00
Aleksey Kladov
7dafe951d4 Fix if and while postfix completions 2020-06-13 14:06:13 +02:00
bors[bot]
c87c4a0a40
Merge #4700
4700: Add top level keywords completion r=matklad a=mcrakhman

This fixes the following issue: https://github.com/rust-analyzer/rust-analyzer/issues/4566. 

Also added simple logic which filters the keywords which can be used with unsafe on the top level.   

Co-authored-by: Mikhail Rakhmanov <rakhmanov.m@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-13 12:02:59 +00:00
Aleksey Kladov
b99b4953c9 More concise completion tests 2020-06-13 13:57:18 +02:00
Aleksey Kladov
ef70076f1d Cleanup 2020-06-13 13:47:30 +02:00
Mikhail Rakhmanov
912f38200f Add keywords completions on source file position 2020-06-13 10:43:39 +02:00
Mikhail Rakhmanov
16bbf4ab7f Merge branch 'master' into keyword_completion
# Conflicts:
#	docs/user/generated_features.adoc
2020-06-13 08:42:15 +02:00
Mikhail Rakhmanov
eeb8b9e236 Fix tests and remove unused methods 2020-06-13 01:21:48 +02:00
Mikhail Rakhmanov
6feb52c12a Add more patterns, tests and fix keywords 2020-06-13 00:55:21 +02:00
Mikhail Rakhmanov
3576671043 Rewrite snapshot checks 2020-06-12 20:30:57 +02:00
Gabriel Valfridsson
66291d19f9 Revert "Hide squiggly for unused and unnecessary"
This reverts commit 599c105e6f.
2020-06-12 18:39:50 +02:00
bors[bot]
b56ad148db
Merge #4857
4857: Fix invalid shorthand initialization diagnostic for tuple structs r=jonas-schievink a=OptimalStrategy

Initializing tuple structs explicitly, like in the example below, produces a "Shorthand struct initialization" diagnostic that leads to a compilation error when applied:
```rust
struct S(usize);

fn main() { 
    let s = S { 0: 0 };  // OK, but triggers the diagnostic
    // let s = S { 0 };  // Compilation error
}
```

This PR adds a check that the field name is not a literal.

Co-authored-by: OptimalStrategy <george@usan-podgornov.com>
Co-authored-by: OptimalStrategy <17456182+OptimalStrategy@users.noreply.github.com>
2020-06-12 14:28:40 +00:00
OptimalStrategy
591b5ec2c1 simplify determining whether the field is a tuple field 2020-06-12 10:16:19 -04:00
bors[bot]
f3d73865d6
Merge #4855
4855: Use more idiomatic style for lifetimes in generated code r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-12 12:49:30 +00:00
bors[bot]
1906655070
Merge #4856
4856: Simplify r=matklad a=Veetaha



Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-06-12 12:41:52 +00:00
Mikhail Rakhmanov
42a719ad25 Remove comment and incorrect assert 2020-06-12 13:14:53 +02:00
Mikhail Rakhmanov
d38bf1624d Return snapshots to tests 2020-06-12 13:09:42 +02:00
Jonas Schievink
0231e4ac77 find_path: return shorter paths for external items
If a containing module is already in scope, there's no need to
use the full path to the item.
2020-06-12 13:01:20 +02:00
Mikhail Rakhmanov
f123539ad2 More assert refactoring 2020-06-12 12:15:53 +02:00
Mikhail Rakhmanov
4c92f2d190 Add more pattern tests 2020-06-12 10:12:15 +02:00
Mikhail Rakhmanov
396167eadb New testing approach for keywords 2020-06-12 08:49:12 +02:00
OptimalStrategy
59f195a323 Fix invalid shorthand initialization diagnostic for tuple structs 2020-06-12 01:11:54 -04:00
Veetaha
4fefc7d06c Simplify 2020-06-12 02:56:06 +03:00
Veetaha
c514060600 Apply codegen with idiomatic lifetimes 2020-06-12 01:26:58 +03:00
Mikhail Rakhmanov
a2b4385f16 Add few smoke tests for patterns and refactoring 2020-06-12 00:17:30 +02:00
Mikhail Rakhmanov
f46bc12199 Add more patterns and keywords 2020-06-11 23:25:58 +02:00
bors[bot]
36353bb182
Merge #4833
4833: Separating parsing of `for` in predicates and types r=matklad a=matthewjasper

We now correctly accept `for<'a> (&'a F): Fn(&'a str)` in a where clause and correctly reject `for<'a> &'a u32` as a type.

Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
2020-06-11 17:33:20 +00:00
Matthew Jasper
8622e4cc1b Add example of old trait object syntax 2020-06-11 18:15:03 +01:00
Matthew Jasper
879693e63c Move complex inline test to own file 2020-06-11 18:14:57 +01:00
bors[bot]
bd61ad756c
Merge #4849
4849: Make known paths use `core` instead of `std` r=matklad a=jonas-schievink

I'm not sure if this causes problems today, but it seems like it easily could, if rust-analyzer processes the libstd sources for the right `--target` and that target is a `#![no_std]`-only target.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-11 15:30:05 +00:00
Jonas Schievink
215e229dd1 Update wrap return tests
Update "no diagnostic" tests, use `()` instead of `String`
2020-06-11 17:28:32 +02:00
bors[bot]
7c617000b8
Merge #4850
4850: Indent chain `.` even if there's more stuff afterwards r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-11 15:20:24 +00:00
Aleksey Kladov
279a1ae564 Indent chain . even if there's more stuff afterwards 2020-06-11 17:13:24 +02:00
Jonas Schievink
90331ea035 Make known paths use core instead of std 2020-06-11 16:23:20 +02:00
Mikhail Rakhmanov
eb4004fdb8 Add todo 2020-06-11 14:32:14 +02:00
Mikhail Rakhmanov
9f91901f7e Add more keywords 2020-06-11 14:16:35 +02:00
Aleksey Kladov
663ce0e99d Remove dead code 2020-06-11 13:34:09 +02:00
bors[bot]
32157d48f4
Merge #4843
4843: Don't guess macro expansion crate r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-06-11 10:18:53 +00:00
Aleksey Kladov
fac7b0e252 Don't guess macro expansion crate 2020-06-11 12:13:14 +02:00
bors[bot]
f320c38aec
Merge #4819
4819: Add an FST index to `ImportMap` and use it to speed up auto import r=matklad a=jonas-schievink

For the importing crate, we still use the symbol index, but I've modified it to only look at files that comprise that crate (instead of the whole workspace).

Oh, and since now the symbol query limit is respected correctly, it's possible that some results from the local crate now disappear if there are many matches.

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

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2020-06-11 10:07:52 +00:00
Jonas Schievink
6766a6b0e1 Add symbol index FIXME 2020-06-11 12:03:08 +02:00
Aleksey Kladov
d8a5d39c2d Make relevant_crates return a Set 2020-06-11 11:30:06 +02:00
Jonas Schievink
dd22657407 ImportMap: use IndexMap internally
It iterates in insertion order, which makes the ordering more
predictable.
2020-06-10 16:15:49 +02:00
Jonas Schievink
7e83ed99a8 Respect casing when searching for imports 2020-06-10 16:04:55 +02:00
Jonas Schievink
ed2817e599 Move limit check down 2020-06-10 12:40:33 +02:00
Jonas Schievink
56c7145993 Limit import map queries 2020-06-10 12:40:33 +02:00
Jonas Schievink
bcf875f46a Clean up import_map.rs 2020-06-10 12:38:58 +02:00