Commit Graph

16093 Commits

Author SHA1 Message Date
Florian Diebold
0623bb4d71 Test for a Salsa bug 2021-03-21 13:33:06 +01:00
Matthias Krüger
ae7e55c1dd clippy::complexity simplifications related to Iterators 2021-03-21 13:13:34 +01:00
Matthias Krüger
bd407a9882 xtask: remove redundant lifetime (clippy::extra_unused_lifetimes) 2021-03-21 12:49:40 +01:00
Matthias Krüger
8a67116857 use strip_prefix() instead of starts_with and slicing (clippy::manual_strip) 2021-03-21 12:38:21 +01:00
Matthias Krüger
3d9b3a8575 remove more redundant clones (clippy::redundant_clone()) 2021-03-21 12:10:39 +01:00
Lukas Wirth
f3c7499be5 Add ' to trigger_characters, allowing more direct lifetime completions 2021-03-21 11:05:04 +01:00
bors[bot]
0d40ff5e62
Merge #8131
8131: Do smart case fuzzy search during flyimports r=SomeoneToIgnore a=SomeoneToIgnore

For now, last actionable part of https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/autoimport.20weirdness

Should help https://github.com/rust-analyzer/rust-analyzer/issues/7902

Now during the flyimport completion, if the input is searched case-sensitively, if the input contains any non-lowercase letters; otherwise the lookup done as before, case-insensitively.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-03-21 09:51:06 +00:00
Kirill Bulatov
b17d99c070 Fix the profile string 2021-03-21 11:45:37 +02:00
Kirill Bulatov
eaa4fcbbde Less reallocations 2021-03-21 11:45:37 +02:00
Kirill Bulatov
ec731e19df Use smart case in flyimport items lookup 2021-03-21 11:45:37 +02:00
bors[bot]
09412d85fc
Merge #8123
8123: Do not display unqualified assoc item completions r=SomeoneToIgnore a=SomeoneToIgnore

Part of https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/autoimport.20weirdness

Removes all flyimport completions for any unqualified associated type, effectively reverting https://github.com/rust-analyzer/rust-analyzer/pull/8095 
I've explained the reasoning in the corresponding FIXME and open to discussions.
As an alternative way, we could add yet another parameter in the method that's used by the `qualify_path` and enable it for the qualify assists only.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-03-21 09:37:08 +00:00
bors[bot]
2280f62a40
Merge #8130
8130: Revert "Temporarily run git describe on CI to debug #8043" r=lnicola a=lnicola

Reverts rust-analyzer/rust-analyzer#8121

bors r+

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-03-21 08:21:52 +00:00
Laurențiu Nicola
76bb56aeb6
Revert "Temporarily run git describe on CI to debug #8043" 2021-03-21 10:21:29 +02:00
Jonas Schievink
5322cd830e Expand legacy-scoped macro during collection 2021-03-21 01:45:24 +01:00
bors[bot]
a0ed87ff56
Merge #8127
8127: Add label completion r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-21 00:29:15 +00:00
Lukas Wirth
64957acb5f Fix incorrect scoping in while expressions 2021-03-21 01:28:42 +01:00
bors[bot]
787bd3c551
Merge #8122
8122: Make bare underscore token an Ident rather than Punct in proc-macro r=edwin0cheng a=kevinmehall

In rustc and proc-macro2, a bare `_` token is parsed for procedural macro purposes as `Ident` rather than `Punct` (see https://github.com/rust-lang/rust/pull/48842). This changes rust-analyzer to match rustc's behavior and implementation by handling `_` as an Ident in token trees, but explicitly preventing `$x:ident` from matching it in MBE.

proc macro crate:
```rust
#[proc_macro]
pub fn input(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    dbg!(input)
}
```

test crate:
```rust
test_proc_macro::input!(_);
```

output (rustc):
```rust
[test-proc-macro/src/lib.rs:10] input = TokenStream [
    Ident {
        ident: "_",
        span: #0 bytes(173..174),
    },
]
```

output (rust-analyzer before this change):
```rust
[test-proc-macro/src/lib.rs:10] input = TokenStream [
    Punct {
        ch: '_',
        spacing: Joint,
        span: 4294967295,
    },
]
```

output (rust-analyzer after this change):
```rust
[test-proc-macro/src/lib.rs:10] input = TokenStream [
    Ident {
        ident: "_",
        span: 4294967295,
    },
]
```


Co-authored-by: Kevin Mehall <km@kevinmehall.net>
2021-03-21 00:10:14 +00:00
Lukas Wirth
62a4677dbc Add label completion 2021-03-21 01:02:22 +01:00
Lukas Wirth
cbd325707b Track labels in scopes 2021-03-21 01:02:01 +01:00
Kevin Mehall
0a7f28620a Fix and test edge cases of _ as ident 2021-03-20 17:54:57 -06:00
bors[bot]
090e013161
Merge #8124
8124: Add basic lifetime completion r=Veykril a=Veykril

This adds basic lifetime completion, basic in the sense that the completions for lifetimes are only shown when the user enters `'` followed by a char. Showing them when nothing is entered is kind of a pain, as we would want them to only show up where they are useful which in turn requires a lot of tree traversal and cursor position checking to verify whether the position is valid for a lifetime. This in itself doesn't seem too bad as usually when you know you want to write a lifetime putting `'` to ask for lifetime completions seems fine.

~~I'll take a look at whether its possible to lift the restriction of having to put a char after `'`.~~ This actually already works so I guess this is the clients responsibility, in which case VSCode doesn't like it.

![TYH9gIlyVo](https://user-images.githubusercontent.com/3757771/111886437-c9b02f80-89cd-11eb-9bee-340f1536b0de.gif)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-20 22:32:25 +00:00
Lukas Wirth
3c000c6364 Add basic lifetime completion 2021-03-20 23:25:07 +01:00
bors[bot]
be3dc673e2
Merge #8125
8125: Don't use an untyped String for ActiveParam tracking r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-20 22:23:50 +00:00
Lukas Wirth
38048c35d8 Don't use an untyped String for ActiveParam tracking 2021-03-20 23:22:09 +01:00
Kirill Bulatov
56a7d246d5 Disable unqualified assoc items completion for now 2021-03-20 23:08:44 +02:00
Kirill Bulatov
879432452d Docs 2021-03-20 22:55:34 +02:00
Kirill Bulatov
a631108d2d Do not query item search by name eagerly 2021-03-20 22:33:54 +02:00
Kirill Bulatov
81961dc035 Do not propose assoc items without qualifiers 2021-03-20 22:18:43 +02:00
cynecx
42abfa0f88 hir_ty: add coverage testing for autoderef_visibility_method test 2021-03-20 20:35:57 +01:00
cynecx
2dc85f739a hir_ty: fix test by removing trailing whitespace 2021-03-20 19:58:00 +01:00
cynecx
ac2a831b2e hir_ty: iterate_method_candidates_for_self_ty pass visible_from_module down to iterate_inherent_methods 2021-03-20 19:50:55 +01:00
cynecx
66d295d72d hir_ty: fix visibility in infer_inherent_method test 2021-03-20 19:47:14 +01:00
Kevin Mehall
0a0e22235b Make bare underscore token an Ident rather than Punct in proc-macro 2021-03-20 12:28:44 -06:00
cynecx
34bb13e293 hir_ty: introduce visible_from_module param into method resolution 2021-03-20 19:28:26 +01:00
cynecx
b1b456c642 hir_ty: check field visibility while iterating through autoderef candidates 2021-03-20 19:07:23 +01:00
cynecx
30980396af hir_ty: add field_visibilities and fn_visibility queries 2021-03-20 18:29:30 +01:00
bors[bot]
104a19853e
Merge #8121
8121: Temporarily run git describe on CI to debug #8043 r=lnicola a=lnicola

bors r+

changelog skip

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-03-20 17:13:03 +00:00
Laurențiu Nicola
14929e6409 Temporarily run git describe to debug #8043 2021-03-20 19:12:19 +02:00
cynecx
edfd741c5b hir_ty: add tests around autoderef with visibility checking 2021-03-20 17:26:18 +01:00
cynecx
15e4aae823 hir_ty: fix tests by making required methods public 2021-03-20 17:12:49 +01:00
bors[bot]
5cc8ad0c4a
Merge #8119
8119:  Don't return a SourceChange on WillRenameFiles when nothing gets refactored r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-20 12:58:28 +00:00
Lukas Wirth
a9a7c5cb1f Don't return a SourceChange on WillRenameFiles when nothing gets refactored 2021-03-20 13:57:58 +01:00
Lukas Wirth
d84912483d Fix add_life_to_type label typo 2021-03-20 13:44:12 +01:00
bors[bot]
4d67032bbb
Merge #8117
8117: Turn Obligation into something similar to chalk_ir::DomainGoal r=flodiebold a=flodiebold

This includes starting to make use of Chalk's `Cast` trait.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-20 11:47:50 +00:00
Florian Diebold
7ec3b66f7a Turn Obligation into something similar to chalk_ir::DomainGoal
This includes starting to make use of Chalk's `Cast` trait.
2021-03-20 12:47:12 +01:00
bors[bot]
5ac0290f53
Merge #8116
8116: Remove WhereClause::Error r=flodiebold a=flodiebold

Chalk doesn't have it, and judging from the removed code, it wasn't useful anyway.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-20 10:23:55 +00:00
Florian Diebold
8e7e405f6a Remove WhereClause::Error
Chalk doesn't have it, and judging from the removed code, it wasn't
useful anyway.
2021-03-20 10:51:00 +01:00
bors[bot]
3901c3b566
Merge #8115
8115: Rename GenericPredicate -> WhereClause r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2021-03-20 09:47:46 +00:00
Florian Diebold
7a5fb37cf1 Rename GenericPredicate -> WhereClause 2021-03-20 10:46:36 +01:00
bors[bot]
8b16af590d
Merge #8112
8112: Revamp `hir_def` attribute API r=Veykril a=jonas-schievink

This adds `AttrsWithOwner`, which can construct an accurate `AttrSourceMap` without requiring additional information from the caller.

r? @Veykril 

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-19 21:20:43 +00:00