]>
git.lizzy.rs Git - rust.git/log
bors[bot] [Wed, 9 Mar 2022 10:26:34 +0000 (10:26 +0000)]
Merge #11663
11663: Internal: Add hir_def::MacroId, add Macro{Id} to ModuleDef{Id} r=Veykril a=Veykril
With this we can now handle macros like we handle ModuleDefs making them work more like other definitions and allowing us to remove a bunch of special cases. This also enables us to track the modules these macros are defined in, instead of only recording the crate they come from.
Introduces a new class of `MacroId`s (for each of the 3 macro kinds) into `hir_def`. We can't reuse `MacroDefId` as that is defined in `hir_expand` which doesn't know of modules, so now we have two different macro ids, this unfortunately requires some back and forth mapping between the two via database accesses which I hope won't be too expensive.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Wed, 9 Mar 2022 10:26:06 +0000 (11:26 +0100)]
Simplify
Lukas Wirth [Wed, 9 Mar 2022 01:08:44 +0000 (02:08 +0100)]
Disable one of the failing SSR test cases
Lukas Wirth [Wed, 9 Mar 2022 00:44:20 +0000 (01:44 +0100)]
fix symbol index collection not collecting legacy macros
Lukas Wirth [Wed, 9 Mar 2022 00:13:38 +0000 (01:13 +0100)]
Fix ProcMacroData recording wrong name for derives
Lukas Wirth [Tue, 8 Mar 2022 23:41:54 +0000 (00:41 +0100)]
Add data queries for macros
Lukas Wirth [Tue, 8 Mar 2022 23:19:53 +0000 (00:19 +0100)]
Remove unnecessary macro_declarations from ItemScope
Lukas Wirth [Tue, 8 Mar 2022 23:01:19 +0000 (00:01 +0100)]
Only store derive<->derive-helper mapping in DefMap
Lukas Wirth [Tue, 8 Mar 2022 22:52:26 +0000 (23:52 +0100)]
Move ide crates to new hir::Macro
Lukas Wirth [Tue, 8 Mar 2022 22:51:48 +0000 (23:51 +0100)]
Move hir to new MacroId
Lukas Wirth [Tue, 8 Mar 2022 22:51:19 +0000 (23:51 +0100)]
Rename MacroDef to Macro
Lukas Wirth [Tue, 8 Mar 2022 20:41:19 +0000 (21:41 +0100)]
Add MacroId to hir_def in attempt to unify Macros with ModuleDefId
bors[bot] [Tue, 8 Mar 2022 10:31:54 +0000 (10:31 +0000)]
Merge #11658
11658: Add back colons around inlay hints r=Veykril a=lnicola
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/2797#issuecomment-
1061594139 .
I originally thought that other extensions don't include the colons, but the TypeScript one seems to do.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Tue, 8 Mar 2022 10:01:02 +0000 (12:01 +0200)]
Add back colons around inlay hints
bors[bot] [Tue, 8 Mar 2022 06:34:49 +0000 (06:34 +0000)]
Merge #11656
11656: Fix package.json key replacement r=lnicola a=lnicola
CC #11653
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Tue, 8 Mar 2022 06:34:03 +0000 (08:34 +0200)]
Fix package.json replacement
bors[bot] [Tue, 8 Mar 2022 01:33:18 +0000 (01:33 +0000)]
Merge #11653
11653: fix: client distribution string replacement looking for wrong key r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/pull/11445
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Tue, 8 Mar 2022 01:32:35 +0000 (02:32 +0100)]
fix: client distribution string replacement looking for wrong key
bors[bot] [Mon, 7 Mar 2022 17:19:43 +0000 (17:19 +0000)]
Merge #11647
11647: Improve inlay hint padding r=lnicola a=lnicola
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Mon, 7 Mar 2022 17:18:36 +0000 (19:18 +0200)]
Improve inlay hint padding
bors[bot] [Mon, 7 Mar 2022 16:49:12 +0000 (16:49 +0000)]
Merge #11445
11445: Upstream inlay hints r=lnicola a=lnicola
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2797
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3394 (since now resolve the hints for the range given only, not for the whole document. We don't actually resolve anything due to [hard requirement](https://github.com/rust-analyzer/rust-analyzer/pull/11445#issuecomment-
1035227434 ) on label being immutable. Any further heavy actions could go to the `resolve` method that's now available via the official Code API for hints)
Based on `@SomeoneToIgnore's` branch, with a couple of updates:
- I squashed, more or less successfully, the commits on that branch
- downloading the `.d.ts` no longer works, but you can get it manually from https://raw.githubusercontent.com/microsoft/vscode/release/1.64/src/vscode-dts/vscode.proposed.inlayHints.d.ts
- you might need to pass `--enable-proposed-api matklad.rust-analyzer`
- if I'm reading the definition right, `InlayHintKind` needs to be serialized as a number, not string
- this doesn't work anyway -- the client-side gets the hints, but they don't display
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Mon, 7 Mar 2022 16:48:27 +0000 (18:48 +0200)]
Add inlayHints cap
Laurențiu Nicola [Mon, 7 Mar 2022 13:42:20 +0000 (15:42 +0200)]
Add missing parameter
Laurențiu Nicola [Mon, 7 Mar 2022 13:24:54 +0000 (15:24 +0200)]
Fix parameter hint position
Laurențiu Nicola [Mon, 7 Mar 2022 13:22:13 +0000 (15:22 +0200)]
Bump esbuild
Laurențiu Nicola [Fri, 4 Mar 2022 06:26:44 +0000 (08:26 +0200)]
Update LSP docs
bors[bot] [Mon, 7 Mar 2022 11:24:52 +0000 (11:24 +0000)]
Merge #11645
11645: Update manual.adoc r=lnicola a=vi
Resolves #11507
Co-authored-by: Vitaly Shukela <vi0oss@gmail.com>
Vitaly Shukela [Mon, 7 Mar 2022 11:22:07 +0000 (14:22 +0300)]
Update manual.adoc
Resolves #11507
bors[bot] [Mon, 7 Mar 2022 10:05:31 +0000 (10:05 +0000)]
Merge #11644
11644: Emit more detailed highlighting for `%`, `>>`, `<<` r=Veykril a=arzg
These are currently just given `operator`, when `%` can be grouped under `arithmetic`, and `>>` and `<<` can be grouped under `bitwise`.
Co-authored-by: Luna Razzaghipour <aramisnoah@gmail.com>
Luna Razzaghipour [Mon, 7 Mar 2022 09:16:03 +0000 (20:16 +1100)]
Emit more detailed highlighting for `%`, `>>`, `<<`
bors[bot] [Sun, 6 Mar 2022 18:31:30 +0000 (18:31 +0000)]
Merge #11639
11639: internal: Re-arrange ide_db modules r=Veykril a=Veykril
Thins out the `helpers` module by giving some items more appropriate places to live
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 6 Mar 2022 18:11:05 +0000 (19:11 +0100)]
Update tidy ignore list
Lukas Wirth [Sun, 6 Mar 2022 18:01:30 +0000 (19:01 +0100)]
internal: Re-arrange ide_db modules
bors[bot] [Sun, 6 Mar 2022 16:56:29 +0000 (16:56 +0000)]
Merge #11637
11637: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 6 Mar 2022 16:56:02 +0000 (17:56 +0100)]
minor: Simplify
bors[bot] [Sun, 6 Mar 2022 12:22:35 +0000 (12:22 +0000)]
Merge #11633
11633: Automatically change text color in logo based on dark mode r=Veykril a=arzg
Currently the black text in the logo in the README just has a white stroke so it’s readable in dark mode. This PR adds automatic detection of whether the user is using system dark mode, and if they are changes the text colour to white and removes the stroke.
Before:
<img width="910" alt="Screen Shot 2022-03-06 at 10 54 35 pm" src="https://user-images.githubusercontent.com/
31783266 /
156921920 -
7ac88aa4 -bab6-44c2-be37-
30338a2d9ec9 .png">
After (now in Chrome because this doesn’t seem to work in Safari):
<img width="822" alt="Screen Shot 2022-03-06 at 11 10 12 pm" src="https://user-images.githubusercontent.com/
31783266 /
156922615 -
41fe63e0 -7901-4cb1-a229-
6d37b6e4369a .png">
<img width="820" alt="Screen Shot 2022-03-06 at 11 10 25 pm" src="https://user-images.githubusercontent.com/
31783266 /
156922619 -
1bdd5b9c -89ac-4fe1-bf17-
1a1ac4ead805 .png">
Co-authored-by: Luna Razzaghipour <aramisnoah@gmail.com>
Luna Razzaghipour [Sun, 6 Mar 2022 11:53:52 +0000 (22:53 +1100)]
Automatically change text color in logo based on dark mode
bors[bot] [Sun, 6 Mar 2022 08:44:54 +0000 (08:44 +0000)]
Merge #11632
11632: Bring back syntax highlighting in test data r=matklad a=matklad
cc #11597
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Aleksey Kladov [Sun, 6 Mar 2022 08:42:17 +0000 (08:42 +0000)]
Bring back syntax highlighting in test data
cc #11597
bors[bot] [Sun, 6 Mar 2022 03:19:54 +0000 (03:19 +0000)]
Merge #11631
11631: internal: Refactor syntax_highlighting r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sun, 6 Mar 2022 02:49:54 +0000 (03:49 +0100)]
internal: Simplify and optimize syntax_highlighting
bors[bot] [Sat, 5 Mar 2022 23:48:54 +0000 (23:48 +0000)]
Merge #11630
11630: fix: Recognize `Self` as a proper keyword r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11627
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 5 Mar 2022 23:26:15 +0000 (00:26 +0100)]
Add a macro case for the keyword highlighting test fixture
Lukas Wirth [Sat, 5 Mar 2022 23:17:40 +0000 (00:17 +0100)]
Fix extern crate self having self unresolved
Lukas Wirth [Sat, 5 Mar 2022 23:12:10 +0000 (00:12 +0100)]
Highlight `Self` as a keyword by default
Lukas Wirth [Sat, 5 Mar 2022 22:53:24 +0000 (23:53 +0100)]
Simplify
Lukas Wirth [Sat, 5 Mar 2022 22:47:44 +0000 (23:47 +0100)]
Fix hover for `Self` keyword
bors[bot] [Sat, 5 Mar 2022 22:34:59 +0000 (22:34 +0000)]
Merge #11629
11629: fix: Fix macro-calls expanding to items in if/while conditions r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11617
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Sat, 5 Mar 2022 22:34:37 +0000 (23:34 +0100)]
Fix highlighting of `Self`
Lukas Wirth [Sat, 5 Mar 2022 21:44:49 +0000 (22:44 +0100)]
Fix test fixture
Lukas Wirth [Sat, 5 Mar 2022 22:20:06 +0000 (23:20 +0100)]
fix: Recognize `Self` as a proper keyword
Lukas Wirth [Sat, 5 Mar 2022 21:04:06 +0000 (22:04 +0100)]
fix macro-calls always expanding to expressions in LetStmt
Lukas Wirth [Sat, 5 Mar 2022 20:58:51 +0000 (21:58 +0100)]
fix: Fix macro-calls expanding to items in if/while conditions
bors[bot] [Sat, 5 Mar 2022 11:31:29 +0000 (11:31 +0000)]
Merge #11598
11598: feat: Parse destructuring assignment r=Veykril a=ChayimFriedman2
Part of #11532.
Lowering is not as easy and may not even be feasible right now as it requires generating identifiers: `(a, b) = (b, a)` is desugared into
```rust
{
let (<gensym_a>, <gensym_b>) = (b, a);
a = <gensym_a>;
b = <gensym_b>;
}
```
rustc uses hygiene to implement that, but we don't support hygiene yet.
However, I think parsing was the main problem as lowering will just affect type inference, and while `{unknown}` is not nice it's much better than a syntax error.
I'm still looking for the best way to do lowering, though.
Fixes #11454.
Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
bors[bot] [Sat, 5 Mar 2022 11:20:05 +0000 (11:20 +0000)]
Merge #11574
11574: Small refactor text edit 2nd r=Veykril a=HansAuger
Some more changes to text_edit. Basic idea is to make `Indel` implement `PartialOrd` to take advantage of some sweet sweet iteration, most notably itertool's `merge`.
Co-authored-by: Moritz Vetter <mv@3yourmind.com>
bors[bot] [Sat, 5 Mar 2022 10:32:07 +0000 (10:32 +0000)]
Merge #11623
11623: fix: Add type variable table to InferenceTableSnapshot r=flodiebold a=tysg
Fixes #11601.
I observed that removing the `rollback` line in https://github.com/rust-analyzer/rust-analyzer/commit/
6fc3d3aa4cbf637d748c60cfdbb98b5f6a040576 fixes the issue.
Looking at the stacktrace, I believe not restoring `type_variable_table` causes `type_variable_table` and `var_unification_table` to go out of sync, then when `hir_ty::infer::unify::InferenceTable::new_var` tries to extend `type_variable_table` to be the same length as `var_unification_table`, problems will arise.
However, I cannot pinpoint exactly how or where the vector capacity overflow happens, so my understanding might not be correct after all.
Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
Tianyi Song [Sat, 5 Mar 2022 09:59:28 +0000 (17:59 +0800)]
Add type variable table to InferenceTableSnapshot
bors[bot] [Fri, 4 Mar 2022 23:20:29 +0000 (23:20 +0000)]
Merge #11622
11622: show variadic args in hover function signature r=Veykril a=euclio
The current behavior is to ignore the ellipsis.
Co-authored-by: Andy Russell <arussell123@gmail.com>
Andy Russell [Fri, 4 Mar 2022 21:24:13 +0000 (16:24 -0500)]
show variadic args in hover function signature
bors[bot] [Fri, 4 Mar 2022 20:21:43 +0000 (20:21 +0000)]
Merge #11595
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg
Fixes #11582. Some questions below in the code review section.
Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
bors[bot] [Fri, 4 Mar 2022 19:47:39 +0000 (19:47 +0000)]
Merge #11620
11620: feat: Support locals with multiple declaration sites r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8860
This implements the first approach of https://github.com/rust-analyzer/rust-analyzer/issues/8860#issuecomment-
845461773 :
> treat every Local as having potentially many sources?
The way this is written does allow changing to a MultiLocal approach instead though, I'll investigate whether that turns out to be better or not.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Fri, 4 Mar 2022 19:09:32 +0000 (20:09 +0100)]
Simplify
Lukas Wirth [Fri, 4 Mar 2022 18:49:08 +0000 (19:49 +0100)]
Support locals with multiple declaration sites
bors[bot] [Fri, 4 Mar 2022 12:55:07 +0000 (12:55 +0000)]
Merge #11140
11140: Preserve order of generic args r=HKalbasi a=HKalbasi
https://github.com/rust-lang/rust/pull/90207 removed order restriction of generic args, i.e. const generics can now become before of type generics. We need to preserve this order to analyze correctly, and this PR does that.
It also simplifies implementation of const generics a bit IMO.
Implementing default generics the same problem of #7434, we need lower them to body and then evaluate them.
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
hkalbasi [Fri, 4 Mar 2022 09:00:53 +0000 (12:30 +0330)]
Resolve only type params in type ns
hkalbasi [Wed, 29 Dec 2021 13:35:59 +0000 (17:05 +0330)]
Preserve order of generic args
Laurențiu Nicola [Fri, 4 Mar 2022 06:15:17 +0000 (08:15 +0200)]
Fix formatting
Laurențiu Nicola [Fri, 4 Mar 2022 06:08:14 +0000 (08:08 +0200)]
Drop hint conversion
Laurențiu Nicola [Fri, 4 Mar 2022 05:48:39 +0000 (07:48 +0200)]
Bump vscode
Kirill Bulatov [Sat, 12 Feb 2022 06:33:04 +0000 (08:33 +0200)]
Remove debugging leftovers
Kirill Bulatov [Fri, 11 Feb 2022 22:48:01 +0000 (00:48 +0200)]
Load hints for part of the file only
Kirill Bulatov [Fri, 11 Feb 2022 23:03:32 +0000 (01:03 +0200)]
Clean up the redundant hints code and config
Laurențiu Nicola [Thu, 10 Feb 2022 10:16:02 +0000 (12:16 +0200)]
Fixes
Laurențiu Nicola [Wed, 9 Feb 2022 17:14:18 +0000 (19:14 +0200)]
Update inlay hints for upstream
Laurențiu Nicola [Wed, 9 Feb 2022 17:13:17 +0000 (19:13 +0200)]
Add log messages
Laurențiu Nicola [Wed, 9 Feb 2022 17:13:04 +0000 (19:13 +0200)]
Bump deps
Kirill Bulatov [Tue, 9 Feb 2021 10:39:40 +0000 (12:39 +0200)]
Add experimental VSCode api
Tianyi Song [Tue, 1 Mar 2022 07:44:53 +0000 (15:44 +0800)]
Lower string literals with real val, not default
bors[bot] [Thu, 3 Mar 2022 22:25:42 +0000 (22:25 +0000)]
Merge #11616
11616: fix: Fix semantic highlighting breaking for lifetimes in macros r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Lukas Wirth [Thu, 3 Mar 2022 21:59:34 +0000 (22:59 +0100)]
slightly improve highlighting performance for derive annotated items
Lukas Wirth [Thu, 3 Mar 2022 21:50:43 +0000 (22:50 +0100)]
fix: Fix semantic highlighting breaking for lifetimes in macros
bors[bot] [Thu, 3 Mar 2022 18:59:22 +0000 (18:59 +0000)]
Merge #11613
11613: fix: Add `abort` to safe intrinsics list r=lnicola a=lnicola
Closes #11611
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Thu, 3 Mar 2022 18:58:20 +0000 (20:58 +0200)]
Add abort to safe intrinsics list
bors[bot] [Thu, 3 Mar 2022 17:42:33 +0000 (17:42 +0000)]
Merge #11610
11610: Add a (currently failing) test for #11242 r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
bors[bot] [Thu, 3 Mar 2022 17:34:00 +0000 (17:34 +0000)]
Merge #11609
11609: Add another case to the syntax fixup code r=flodiebold a=flodiebold
Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Florian Diebold [Thu, 3 Mar 2022 17:32:40 +0000 (18:32 +0100)]
Add a (currently failing) test for #11242
Florian Diebold [Thu, 3 Mar 2022 17:29:40 +0000 (18:29 +0100)]
Add another case to the syntax fixup code
Chayim Refael Friedman [Wed, 2 Mar 2022 01:50:54 +0000 (01:50 +0000)]
Do not consider `_` to be an expression for `macro_rules!`
Chayim Refael Friedman [Thu, 24 Feb 2022 08:49:47 +0000 (08:49 +0000)]
Parse destructuring assignment
The only patterns we should parse are `..` in structs and `_`: the rest are either not supported or already valid expressions.
bors[bot] [Tue, 1 Mar 2022 18:27:04 +0000 (18:27 +0000)]
Merge #11593
11593: Build release binaries on Ubuntu 18.04 r=lnicola a=lnicola
Fixes #11558
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Tue, 1 Mar 2022 05:24:27 +0000 (07:24 +0200)]
Build release binaries on Ubuntu 18.04
bors[bot] [Mon, 28 Feb 2022 10:15:44 +0000 (10:15 +0000)]
Merge #11433
11433: minor: Add scary warning to `onEnter` r=lnicola a=lnicola
Closes #11432
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Laurențiu Nicola [Tue, 8 Feb 2022 06:34:24 +0000 (08:34 +0200)]
Add scary warning to onEnter
bors[bot] [Mon, 28 Feb 2022 09:18:26 +0000 (09:18 +0000)]
Merge #11579
11579: minor: Future-proof against a next edition by using `>=` and not `==` r=lnicola a=ChayimFriedman2
So that we won't have a strange bug when edition 2024 will land.
rustc [also does that](https://github.com/rust-lang/rust/blob/
427cf81206d3b6cf41c86c1b9ce113a33f1ce860 /compiler/rustc_builtin_macros/src/edition_panic.rs#L84).
Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
Chayim Refael Friedman [Mon, 28 Feb 2022 09:13:55 +0000 (11:13 +0200)]
Future-proof against a next edition by using `>=` and not `==`
So that we won't have a strange bug when edition 2024 will land.
rustc [also does that](https://github.com/rust-lang/rust/blob/
427cf81206d3b6cf41c86c1b9ce113a33f1ce860 /compiler/rustc_builtin_macros/src/edition_panic.rs#L84).
Moritz Vetter [Mon, 28 Feb 2022 04:13:45 +0000 (05:13 +0100)]
redirct: use iterators and knowledge about preordered arrays for more efficient merging
bors[bot] [Sun, 27 Feb 2022 12:00:04 +0000 (12:00 +0000)]
Merge #11573
11573: refactorings and FIXME fixes in text edit r=lnicola a=HansAuger
This is mainly me learning some rust, and only anecdotally about addressing some `fixme`s. Feel free to nope :)
There is a follow up PR in the pipeline which tackles the other two `fixme`s but it's a bit more invasive. So I wanted to get this out of the way
Co-authored-by: Moritz Vetter <mv@3yourmind.com>
bors[bot] [Sun, 27 Feb 2022 11:34:01 +0000 (11:34 +0000)]
Merge #11567
11567: Fix `if` in #11561 r=Veykril a=ChayimFriedman2
Fixes #11561.
Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
bors[bot] [Sun, 27 Feb 2022 09:17:46 +0000 (09:17 +0000)]
Merge #11570
11570: minor: Remove misleading comments r=lnicola a=ChayimFriedman2
They're not true anymore after #11375.
Co-authored-by: Chayim Refael Friedman <chayimfr@gmail.com>
Chayim Refael Friedman [Sun, 27 Feb 2022 07:52:11 +0000 (09:52 +0200)]
Remove misleading comments
They're not true anymore after #11375.