Commit graph

8547 commits

Author SHA1 Message Date
Aleksey Kladov
a3a8ad8bc4 Don't rely on display names in inlay_hints 2020-10-20 18:14:14 +02:00
Aleksey Kladov
f753c3ecd2 Support Display name in project.json 2020-10-20 17:13:15 +02:00
Aleksey Kladov
3b1a648539 More type safety around names 2020-10-20 17:09:03 +02:00
Aleksey Kladov
a85c4280bf Introduce CrateDisplayName 2020-10-20 16:00:51 +02:00
Aleksey Kladov
af4e75533f Rename declaration_name -> display_name
Declaration names sounds like a name of declaration -- something you
can use for analysis. It empathically isn't, and is just a label
displayed in various UI. It's important not to confuse the two, least
we accidentally mix semantics with UI (I believe, there's already a
case of this in the FamousDefs at least).
2020-10-20 15:38:11 +02:00
bors[bot]
be762ccccd
Merge #6294
6294: Add a hacky remidy for #6038 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-20 10:36:28 +00:00
Aleksey Kladov
7a21e9302e Add a hacky remidy for #6038
The proper fix I think is:

* move rust-lang/rust library crates to a separate workspace
* when packaging rust-src component, vendor sources of external deps
2020-10-20 12:34:39 +02:00
Igor Aleksanov
2a20e7795c Add descriptions for diagnostics parseable by xtask 2020-10-19 20:55:16 +03:00
Aleksey Kladov
4fbb602b2d Minor, rename feature 2020-10-19 15:53:48 +02:00
Aleksey Kladov
8421115354 Try to fix publishing
This errro specifically:

Updating crates.io index
	 error: failed to select a version for the requirement `ra_ap_stdx = "^0.0.0"`
	 candidate versions found which didn't match: 0.0.20
	 location searched: /home/runner/work/rust-analyzer/rust-analyzer/crates/stdx
	 required by package `ra_ap_completion v0.0.20 (/home/runner/work/rust-analyzer/rust-analyzer/crates/completion)`
	 error: unable to update Cargo.lock
	 Error: Process completed with exit code 1.
2020-10-19 15:18:28 +02:00
Aleksey Kladov
604caedeb2 Change visibility works for type aliases 2020-10-18 17:04:12 +02:00
Igor Aleksanov
9e7c952bbd Extract call_info and completion into separate crates 2020-10-18 13:09:00 +03:00
Aleksey Kladov
6c7769a2e3 update deps 2020-10-18 01:53:01 +02:00
Aleksey Kladov
13451d3dc4 Complete methods when receiver is a macro 2020-10-17 23:43:13 +02:00
Aleksey Kladov
4fe4c30436 Improve readability 2020-10-17 23:35:21 +02:00
Igor Aleksanov
99c435939c Scan all ancestors for the impl trait block check 2020-10-17 11:17:58 +03:00
Igor Aleksanov
6f573bd84f Allow hints after 'fn' keyword if it's an impl trait block 2020-10-17 11:03:07 +03:00
Igor Aleksanov
8f303daf45 Add test for new pattern functions 2020-10-17 10:56:00 +03:00
Igor Aleksanov
6ae4c70a0a Improve test_no_completions_required test 2020-10-17 10:47:35 +03:00
Igor Aleksanov
70157f07d9 Remove redundant completions 2020-10-17 10:27:59 +03:00
bors[bot]
1af6275f20
Merge #6246
6246: Follow symlinks when walking project trees r=lnicola a=dfoxfranke

Fixes #3691.

~~WIP pending further testing~~:

- [X] Verify that symlinked files get indexed.
- [x] Verify that files in symlinked directories get indexed.
- [x] Verify that inotify events are properly received and handled when the target of a symlink resides outside the project tree.

Co-authored-by: Daniel Fox Franke <dfoxfranke@gmail.com>
2020-10-16 12:53:10 +00:00
Daniel Fox Franke
e821aa842b Follow symlinks when walking project trees
Fixes #3691
2020-10-15 14:22:36 -04:00
bors[bot]
0d45802d67
Merge #6220
6220: implement binary operator overloading type inference r=flodiebold a=ruabmbua

Extend type inference of *binary operator expression*, by adding support for operator overloads.

Before this merge request, the type inference of binary expressions could only resolve operations done on built-in primitive types. This merge requests adds a code path, which is executed in case the built-in inference could not get any results. It resolves the proper operator overload trait in *core::ops* via lang items, and then resolves the associated *Output* type.

```rust
struct V2([f32; 2]);

#[lang = "add"]
pub trait Add<Rhs = Self> {
    /// The resulting type after applying the `+` operator.
    type Output;

    /// Performs the `+` operation.
    #[must_use]
    fn add(self, rhs: Rhs) -> Self::Output;
}

impl Add<V2> for V2 {
    type Output = V2;

    fn add(self, rhs: V2) -> V2 {
        let x = self.0[0] + rhs.0[0];
        let y = self.0[1] + rhs.0[1];
        V2([x, y])
    }
}

fn test() {
    let va = V2([0.0, 1.0]);
    let vb = V2([0.0, 1.0]);

    let r = va + vb; // This infers to V2 now
}
```

There is a problem with operator overloads, which do not explicitly set the *Rhs* type parameter in the respective impl block. 

**Example:**

```rust
impl Add for V2 {
    type Output = V2;

    fn add(self, rhs: V2) -> V2 {
        let x = self.0[0] + rhs.0[0];
        let y = self.0[1] + rhs.0[1];
        V2([x, y])
    }
}
```

In this case, the trait solver does not realize, that the *Rhs* type parameter is actually self in the context of the impl block. This stops type inference in its tracks, and it can not resolve the associated *Output* type.

I guess we can still merge this back, because it increases the amount of resolved types, and does not regress anything (in the tests).

Somewhat blocked by https://github.com/rust-analyzer/rust-analyzer/issues/5685
Resolves  https://github.com/rust-analyzer/rust-analyzer/issues/5544

Co-authored-by: Roland Ruckerbauer <roland.rucky@gmail.com>
2020-10-15 18:02:27 +00:00
Aleksey Kladov
c5868a4879 Clarify the names one more time 2020-10-15 17:38:51 +02:00
Aleksey Kladov
56e67e3a39 More idiomatic classification API 2020-10-15 17:38:17 +02:00
Aleksey Kladov
f9c1336873 More clarifications 2020-10-15 17:37:55 +02:00
Aleksey Kladov
bc287b8f9b Unconfuse expression and pattern field init shorthands 2020-10-15 17:37:36 +02:00
Aleksey Kladov
fa3c449d8f Clarify NameClass names a bit 2020-10-15 17:37:36 +02:00
bors[bot]
7fadc78ebb
Merge #6242
6242: Diagnost shorthand in patterns r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-15 15:11:36 +00:00
Aleksey Kladov
3086fb2ef4 Move field_shorthand to a separate module 2020-10-15 17:10:06 +02:00
Aleksey Kladov
1022672af0 Diagnose shorthand in patterns as well 2020-10-15 17:03:52 +02:00
Aleksey Kladov
e9903a91cd flatten 2020-10-15 16:51:55 +02:00
Aleksey Kladov
c8cbd398e4 Prepare for pat_field_shorthand 2020-10-15 16:48:25 +02:00
bors[bot]
8090799aa2
Merge #6234
6234: Fix hover over field pattern shorthand r=matklad a=Vlad-Shcherbina

Instead of the information about the field, it now shows the information
about the local.

Fixes #6146

Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
2020-10-15 13:09:27 +00:00
Lukas Wirth
f8a7cc678d Document auto_import as a feature 2020-10-15 14:57:19 +02:00
bors[bot]
3a38554f86
Merge #6231
6231: Factor macro_rules and format-string highlighting out into submodules r=Veykril a=Veykril

This moves `format`-like macro string highlighting and macro_rules highlight skipping out of the main module.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-14 20:52:41 +00:00
Lukas Wirth
bab29e65eb Default::default the highlighters 2020-10-14 22:50:26 +02:00
Vlad Shcherbina
e6fbb94edd Fix hover over field pattern shorthand
Instead of the information about the field, it now shows the information
about the local.

Fixes #6146
2020-10-14 21:22:00 +03:00
Lukas Wirth
8c6dc5f28a Factor macro_rules! highlighting out 2020-10-14 19:23:59 +02:00
Lukas Wirth
df87be88d8 Factor format string highlighting out 2020-10-14 19:23:45 +02:00
Roland Ruckerbauer
0e9d1e17d6 binary operator overload type inference: add test mark 2020-10-14 19:00:04 +02:00
Aleksey Kladov
1b3b8c7fda Log around sysroot discovery 2020-10-14 17:22:07 +02:00
Laurențiu Nicola
8cc175ee9b Add docs for dbgr and call 2020-10-14 16:23:51 +03:00
bors[bot]
3e450cf89f
Merge #6207 #6224 #6226 #6227
6207: Extract ImportAssets out of auto_import r=matklad a=Veykril

See https://github.com/rust-analyzer/rust-analyzer/pull/6172#issuecomment-707182140

I couldn't fully pull out `AssistContext` as `find_node_at_offset_with_descend`: 81fa00c5b5/crates/assists/src/assist_context.rs (L90-L92) requires the `SourceFile` which is private in it and I don't think making it public just for this is the right call?

6224: ⬆️ salsa r=matklad a=matklad

bors r+
🤖

6226: Add reminder to update lsp-extensions.md r=matklad a=matklad

bors r+
🤖

6227: Reduce bors timeout r=matklad a=matklad

bors r+
🤖

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-14 11:37:51 +00:00
Aleksey Kladov
41e2639f35 ⬆️ salsa 2020-10-14 12:40:48 +02:00
bors[bot]
b62f48f535
Merge #6217
6217: Bump pulldown-cmark r=matklad a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-14 10:26:13 +00:00
Lukas Wirth
03b77b03fe Fix stackoverflow in insert_use::recursive_merge 2020-10-14 01:43:56 +02:00
Roland Ruckerbauer
4e49b2f731 Implement binary operator overloading type inference 2020-10-13 20:48:08 +02:00
Lukas Wirth
01b410c69a Slightly cleanup import_assets module 2020-10-13 20:02:14 +02:00
Laurențiu Nicola
e559066bed Bump pulldown-cmark 2020-10-13 20:41:49 +03:00