Commit Graph

13724 Commits

Author SHA1 Message Date
bors[bot]
38d595c36f
Merge #6644
6644: Simplify error formatting r=lnicola a=lnicola

CC jonas-schievink

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-26 19:18:40 +00:00
Laurențiu Nicola
3aca697511 Simplify error formatting 2020-11-26 21:07:15 +02:00
bors[bot]
deb3550fea
Merge #6643
6643: Remove unused import r=lnicola a=lnicola

Not sure why CI didn't catch this...

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-26 17:28:43 +00:00
Laurențiu Nicola
a5477d7f29 Remove unused import 2020-11-26 19:25:59 +02:00
bors[bot]
3a96c29028
Merge #6641
6641: Fix def map volatility with `#[cfg]` diagnostics r=jonas-schievink a=jonas-schievink

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 16:30:05 +00:00
Jonas Schievink
519d870c11 Don't store SyntaxNodePtr in CrateDefMap
It is volatile across reparses and makes incrementality worse.
2020-11-26 17:29:09 +01:00
Jonas Schievink
74cb3e96a5 Test def map invalidation with #[cfg] below change 2020-11-26 17:28:00 +01:00
bors[bot]
ad343870ec
Merge #6640
6640: Implement `Display` for macro expansion errors r=jonas-schievink a=jonas-schievink



Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:56:58 +00:00
Jonas Schievink
2c85db8eb6 Implement Display for macro expansion errors 2020-11-26 16:56:22 +01:00
bors[bot]
db061fb274
Merge #6639
6639: Use `ExpandResult` instead of `MacroResult` r=jonas-schievink a=jonas-schievink

`MacroResult` is redundant.

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:48:58 +00:00
Jonas Schievink
6a9338e979 Use ExpandResult instead of MacroResult
`MacroResult` is redundant
2020-11-26 16:48:17 +01:00
bors[bot]
1542797284
Merge #6638
6638: Use named fields in `ExpandResult` r=jonas-schievink a=jonas-schievink

bors r+ 🤖 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 15:05:09 +00:00
Jonas Schievink
c784c8ec76 Use named fields in ExpandResult 2020-11-26 16:04:23 +01:00
bors[bot]
0bcd8147ec
Merge #6637
6637: Publish diagnostics on file open r=jonas-schievink a=jonas-schievink

Diagnostics are sometimes only showing up when typing. This should fix that.

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-26 12:42:29 +00:00
Jonas Schievink
9ed883f373 Publish diagnostics on file open
Diagnostics are sometimes only showing up when typing.
This should fix that.
2020-11-26 13:33:47 +01:00
bors[bot]
db6988d4e7
Merge #6614 #6632
6614: Improve autoimports on completion speed r=matklad a=SomeoneToIgnore

Presumably closes https://github.com/rust-analyzer/rust-analyzer/issues/6594
May help https://github.com/rust-analyzer/rust-analyzer/issues/6612

* Ignore modules eaferly
* Do less completion string rendering

6632: Pin cargo_metadata r=matklad a=kjeremy

See: https://github.com/oli-obk/cargo_metadata/pull/142#issuecomment-733653275

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-26 10:43:35 +00:00
bors[bot]
ed5c1753b3
Merge #6496
6496: Use builtin scopes more r=matklad a=georgewfraser

VSCode has added more builtin fallback scopes, so we can remove some of our fallback scopes by aligning with their conventions. 

Note that the macro scope doesn't seem to actually *work* at the moment. I have filed a bug with VSCode: https://github.com/microsoft/vscode/issues/110150

Co-authored-by: George Fraser <george@fivetran.com>
2020-11-26 10:36:26 +00:00
George Fraser
ac314f88c6 Just remove the macro fallback 2020-11-25 08:41:40 -08:00
kjeremy
9a3142664b Pin cargo_metadata 2020-11-25 10:11:53 -05:00
bors[bot]
9b512f8569
Merge #6631
6631: Gate autoimports begind experimental completions flag r=kjeremy a=SomeoneToIgnore

Part of https://github.com/rust-analyzer/rust-analyzer/issues/6612

Adds a possibility to disable autoimports:

<img width="598" alt="image" src="https://user-images.githubusercontent.com/2690773/100156673-f8037f80-2eb1-11eb-8e74-59ebe4260ba3.png">

and other experimental completions we might want to add later.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-11-24 23:40:05 +00:00
Kirill Bulatov
9812150047 Document experimental completions 2020-11-25 00:42:58 +02:00
Kirill Bulatov
4c95c6e25d Gate autoimports begind experimental completions flag 2020-11-25 00:30:28 +02:00
bors[bot]
5478aaebfe
Merge #6630
6630: followup to "hir_expand: propagate expansion errors" r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/6625

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 21:01:33 +00:00
Jonas Schievink
9559bce311 Rename parse_macro to parse_macro_expansion
This does not parse macros, it expands a macro and parses the *result*
2020-11-24 21:57:51 +01:00
Jonas Schievink
f9d0d51101 hir_expand::db: reduce fn visibility 2020-11-24 21:55:08 +01:00
Jonas Schievink
9a3bb19d32 Remove fixed FIXME, propagate errors better 2020-11-24 21:52:19 +01:00
bors[bot]
e2d8e1120f
Merge #6625
6625: hir_expand: propagate expansion errors r=jonas-schievink a=jonas-schievink

This is needed to collect and report expansion errors later.

bors r+ 🤖

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-11-24 18:01:49 +00:00
Jonas Schievink
d5e9bf80f9 hir_expand: propagate expansion errors 2020-11-24 19:00:23 +01:00
bors[bot]
d2f398cd76
Merge #6624
6624: Check structs for match exhaustiveness r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 17:51:46 +00:00
Lukas Wirth
377fa7db3f Check structs for match exhaustiveness 2020-11-24 18:50:56 +01:00
bors[bot]
b769f5da6e
Merge #6621
6621: Handle ellipsis in tuple patterns in match exhaustiveness checking r=flodiebold a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:57:32 +00:00
Lukas Wirth
4d841dc4e7 Add middle ellipsis missing arm text 2020-11-24 16:46:06 +01:00
Lukas Wirth
a4b5275656 Handle ellipsis in tuple patterns in match exhaustiveness checking 2020-11-24 16:43:28 +01:00
bors[bot]
67d45851bf
Merge #6618
6618: Properly infer tuple patterns when encountering ellipsis r=Veykril a=Veykril

We basically just split the subpatterns into two halves when the ellipsis is present and then offset the latter half to account for the ignored bindings.

Fixes #6616

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-11-24 15:13:25 +00:00
Lukas Wirth
a5efefd3d7 Properly infer tuple struct patterns when encountering ellipsis 2020-11-24 16:11:40 +01:00
bors[bot]
f7e63bdf91
Merge #6620
6620: cargo update (without cargo_metadata) r=kjeremy a=kjeremy

This is a `cargo update` run without updating `cargo_metadata`.

`cargo_metadata` `0.12.1` pins `semver-parser` to `0.10.0` (4e88e5624c) which brings back the compile time blowup that @matklad tried so hard to avoid in https://github.com/steveklabnik/semver-parser/pull/50.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-24 15:00:54 +00:00
kjeremy
24bbf3b838 cargo update 2020-11-24 09:13:26 -05:00
bors[bot]
08a3f8f7f0
Merge #6619
6619: New lsp-types to fix versioning r=kjeremy a=kjeremy

Fixes #6603

Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-11-24 13:53:38 +00:00
kjeremy
e981485b76 New lsp-types to fix versioning
Fixes #6603
2020-11-24 08:52:24 -05:00
Lukas Wirth
35dd62e915 Properly infer tuple patterns when encountering ellipsis 2020-11-24 13:56:20 +01:00
bors[bot]
2d2615db15
Merge #6617
6617: Avoid string allocations in ignore_test r=lnicola a=lnicola

CC @jakobhellermann

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-11-24 10:10:05 +00:00
Laurențiu Nicola
8af1ed6a09 Avoid string allocations in ignore_test 2020-11-24 12:08:54 +02:00
bors[bot]
6294286fee
Merge #6610
6610: add 'Re-enable this test' assist r=SomeoneToIgnore a=jakobhellermann

The `Ignore this test` assist previously allowed ignoring multiple times, each time adding a `#[ignore]` attribute.

This PR instead shows an assist to undo the ignoring.

Co-authored-by: Jakob Hellermann <jakob.hellermann@protonmail.com>
2020-11-24 00:54:53 +00:00
bors[bot]
2ff78cde31
Merge #6613
6613: Don't assume DidChangeTextDocument paths exist r=SomeoneToIgnore a=mjibson

Fixes #5933

Co-authored-by: Matt Jibson <matt.jibson@gmail.com>
2020-11-24 00:41:08 +00:00
Kirill Bulatov
4baac238a8 Improve autoimports on completion speed
* Ignore modules eaferly
* Do less completion string rendering
2020-11-24 02:28:45 +02:00
Matt Jibson
117c793e80 Don't assume DidChangeTextDocument paths exist
Fixes #5933
2020-11-23 16:35:34 -07:00
Jakob Hellermann
a172c2317c add 'Re-enable this test' assist 2020-11-23 20:31:57 +01:00
bors[bot]
036ea6317c
Merge #6609
6609: Minor, import style r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-11-23 18:20:01 +00:00
Aleksey Kladov
2c083c993f Minor, import style 2020-11-23 21:19:37 +03:00
bors[bot]
224387a4de
Merge #6606
6606: Parse unsafe extern block r=lnicola a=dtolnay

`unsafe extern` block is parsed successfully by rustc, which means it is usable in attribute macro input.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=6f805556f176d082d87255957f16b5f6

```rust
#[cfg(parse)]
unsafe extern "C++" {
    fn demo();
}
```

```diff
  SOURCE_FILE@0..52
-   ERROR@0..33
+   EXTERN_BLOCK@0..52
      ATTR@0..13
        POUND@0..1 "#"
        L_BRACK@1..2 "["
        PATH@2..5
          PATH_SEGMENT@2..5
            NAME_REF@2..5
              IDENT@2..5 "cfg"
        TOKEN_TREE@5..12
          L_PAREN@5..6 "("
          IDENT@6..11 "parse"
          R_PAREN@11..12 ")"
        R_BRACK@12..13 "]"
      WHITESPACE@13..14 "\n"
      UNSAFE_KW@14..20 "unsafe"
      WHITESPACE@20..21 " "
      ABI@21..33
        EXTERN_KW@21..27 "extern"
        WHITESPACE@27..28 " "
        STRING@28..33 "\"C++\""
-   WHITESPACE@33..34 " "
-   ERROR@34..52
-     L_CURLY@34..35 "{"
-     WHITESPACE@35..40 "\n    "
-     FN@40..50
-       FN_KW@40..42 "fn"
-       WHITESPACE@42..43 " "
-       NAME@43..47
-         IDENT@43..47 "demo"
-       PARAM_LIST@47..49
-         L_PAREN@47..48 "("
-         R_PAREN@48..49 ")"
-       SEMICOLON@49..50 ";"
-     WHITESPACE@50..51 "\n"
-     R_CURLY@51..52 "}"
+     WHITESPACE@33..34 " "
+     EXTERN_ITEM_LIST@34..52
+       L_CURLY@34..35 "{"
+       WHITESPACE@35..40 "\n    "
+       FN@40..50
+         FN_KW@40..42 "fn"
+         WHITESPACE@42..43 " "
+         NAME@43..47
+           IDENT@43..47 "demo"
+         PARAM_LIST@47..49
+           L_PAREN@47..48 "("
+           R_PAREN@48..49 ")"
+         SEMICOLON@49..50 ";"
+       WHITESPACE@50..51 "\n"
+       R_CURLY@51..52 "}"
```

This is of interest for https://github.com/dtolnay/cxx.

Co-authored-by: David Tolnay <dtolnay@gmail.com>
2020-11-23 07:05:31 +00:00