Commit Graph

15860 Commits

Author SHA1 Message Date
Lukas Wirth
f3c7499be5 Add ' to trigger_characters, allowing more direct lifetime completions 2021-03-21 11:05:04 +01: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
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
Kevin Mehall
0a0e22235b Make bare underscore token an Ident rather than Punct in proc-macro 2021-03-20 12:28:44 -06: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
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
Jonas Schievink
636de3c709 Add AttrsWithOwner and clean up source_map 2021-03-19 21:23:57 +01:00
Jonas Schievink
fc5f73de45 Move AttrsOwnerNode to syntax and make it public 2021-03-19 20:05:17 +01:00
bors[bot]
fc21640a65
Merge #8111
8111: Return `Either` from `MacroDefId::ast_id` r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-19 18:56:38 +00:00
Jonas Schievink
93aeb16eb2 Return Either from MacroDefId::ast_id 2021-03-19 19:56:13 +01:00
bors[bot]
0392e63c95
Merge #8110
8110: simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-19 18:01:34 +00:00
Aleksey Kladov
ba72308588 simplify
changelog skip
2021-03-19 21:00:20 +03:00
bors[bot]
b54e4b87e8
Merge #8109
8109: Make ast editing more ergonomic r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-03-19 17:54:30 +00:00
Aleksey Kladov
a61691026a Make ast editing more ergonomic
changelog internal
2021-03-19 20:53:23 +03:00
bors[bot]
2813afd059
Merge #8108
8108: Fix handling of `#![cfg]` in outline module file r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-19 17:25:09 +00:00
Jonas Schievink
cf494a515f Fix handling of #![cfg] in outline module file 2021-03-19 18:24:04 +01:00
bors[bot]
dc8e2fea98
Merge #8106
8106: Add builtin macro-like attributes r=jonas-schievink a=jonas-schievink

We also have to know about these to resolve them

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-19 13:34:46 +00:00
Jonas Schievink
506467b4c8 Add builtin macro-like attributes 2021-03-19 14:33:31 +01:00
bors[bot]
c089795713
Merge #8104
8104: Rename derive-specific APIs r=jonas-schievink a=jonas-schievink

Indicate that they're derive-specific

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-19 13:23:56 +00:00
Jonas Schievink
54c78c96db Rename derive-specific APIs 2021-03-19 14:23:13 +01:00
bors[bot]
a627377949
Merge #8102
8102: Cleanup qualify_path r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-19 12:13:21 +00:00
Lukas Wirth
c34a9f10b1 Cleanup qualify_path 2021-03-19 13:12:00 +01:00
bors[bot]
7200b994c9
Merge #8097
8097: Parse extended_key_value_attributes r=jonas-schievink a=Veykril

Companion PR https://github.com/rust-analyzer/ungrammar/pull/31

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-19 11:38:40 +00:00
bors[bot]
98d29d4f53
Merge #8101
8101: Replace Projection variant in GenericPredicate with AliasEq r=flodiebold a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-19 11:12:54 +00:00
Lukas Wirth
8996b1a235 Replace Projection variant in GenericPredicate with AliasEq 2021-03-19 12:12:18 +01:00
Lukas Wirth
4771a56791 Parse extended_key_value_attributes 2021-03-19 02:13:46 +01:00
bors[bot]
26fdd17cc6
Merge #8099
8099: Document fields of `ModuleId` r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-03-18 23:07:41 +00:00
Jonas Schievink
fcbaf585cb Document fields of ModuleId 2021-03-19 00:06:35 +01:00
bors[bot]
86878443b1
Merge #8095
8095: Fix associated items not being appended to paths in import_assets r=SomeoneToIgnore a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-18 21:40:12 +00:00
bors[bot]
48d6324a3f
Merge #8086
8086: Use a highlight modifier for intra doc links r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-03-18 21:32:34 +00:00