]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoapplied rustfmt
Ole Strohm [Tue, 22 Mar 2022 11:10:48 +0000 (11:10 +0000)]
applied rustfmt

2 years agofix: fill_match_arms doesn't add wildcard pat for local enums
Ole Strohm [Tue, 22 Mar 2022 10:56:20 +0000 (10:56 +0000)]
fix: fill_match_arms doesn't add wildcard pat for local enums

2 years agoMerge #11785
bors[bot] [Mon, 21 Mar 2022 23:33:58 +0000 (23:33 +0000)]
Merge #11785

11785: fix: Fix tuple- and record struct completions not working with existing braces r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix tuple- and record struct completions not working with existing braces
Lukas Wirth [Mon, 21 Mar 2022 20:45:29 +0000 (21:45 +0100)]
fix: Fix tuple- and record struct completions not working with existing braces

2 years agoMerge #11782
bors[bot] [Mon, 21 Mar 2022 18:42:24 +0000 (18:42 +0000)]
Merge #11782

11782: fix: Fix flyimport showing functions in pattern position r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix flyimport showing functions in pattern position
Lukas Wirth [Mon, 21 Mar 2022 18:41:39 +0000 (19:41 +0100)]
fix: Fix flyimport showing functions in pattern position

2 years agoMerge #11776
bors[bot] [Mon, 21 Mar 2022 09:04:40 +0000 (09:04 +0000)]
Merge #11776

11776: Replace write! with direct `Formatter` calls r=Veykril a=lnicola

The final executable is somehow larger (36 239 296 vs 36 238 336 bytes), but this saves us a bit of `text` and `data`:

```
   text    data     bss     dec     hex filename
23719199 1126625    4377 24850201 17b2f19 rust-analyzer-baseline
23716027 1126377    4377 24846781 17b21bd rust-analyzer-pr
```

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoReplace write! with direct calls
Laurențiu Nicola [Mon, 21 Mar 2022 08:43:36 +0000 (10:43 +0200)]
Replace write! with direct calls

2 years agoMerge #11690
bors[bot] [Sun, 20 Mar 2022 21:15:49 +0000 (21:15 +0000)]
Merge #11690

11690: feat: Add an assist for inlining type aliases r=Veykril a=steven-joruk

I'm working towards implementing #10881, but I'd like to get this in first with earlier feedback.

Is `inline_type_alias` a good enough name? I guess the follow up assist would be called `inline_type_alias_into_all_users` based on that.

![valid_inlines](https://user-images.githubusercontent.com/1277939/158020510-fed78b5c-4c7e-46d1-9151-3044a29b9990.gif)

![invalid_inlines](https://user-images.githubusercontent.com/1277939/158020516-8a2deb6d-c6ec-4adf-a15b-c514fc97dc43.gif)

Co-authored-by: Steven Joruk <steven@joruk.com>
2 years agorefactor: Do more work in inline_type_alias closure
Steven Joruk [Sun, 20 Mar 2022 20:53:03 +0000 (20:53 +0000)]
refactor: Do more work in inline_type_alias closure

2 years agoMerge #11775
bors[bot] [Sun, 20 Mar 2022 18:31:27 +0000 (18:31 +0000)]
Merge #11775

11775: internal: Treat `global_asm` and `asm` macros as unsafe r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Treat {global_}asm macros as unsafe
Lukas Wirth [Sun, 20 Mar 2022 18:27:46 +0000 (19:27 +0100)]
internal: Treat {global_}asm macros as unsafe

2 years agoMerge #11774
bors[bot] [Sun, 20 Mar 2022 18:15:29 +0000 (18:15 +0000)]
Merge #11774

11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Sun, 20 Mar 2022 18:13:50 +0000 (19:13 +0100)]
Simplify

2 years agofeat: Tag macro calls as unsafe if they expand to unsafe expressions
Lukas Wirth [Sun, 20 Mar 2022 18:07:44 +0000 (19:07 +0100)]
feat: Tag macro calls as unsafe if they expand to unsafe expressions

2 years agoMerge #11771
bors[bot] [Sun, 20 Mar 2022 13:47:16 +0000 (13:47 +0000)]
Merge #11771

11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUpdate inlay hint feature docs
Lukas Wirth [Sun, 20 Mar 2022 13:41:27 +0000 (14:41 +0100)]
Update inlay hint feature docs

2 years agofeat: Visualize compiler inserted reborrows via inlay hints
Lukas Wirth [Sun, 20 Mar 2022 13:38:16 +0000 (14:38 +0100)]
feat: Visualize compiler inserted reborrows via inlay hints

2 years agoMerge #11765
bors[bot] [Sat, 19 Mar 2022 19:26:34 +0000 (19:26 +0000)]
Merge #11765

11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix closure hints using macro ranges
Lukas Wirth [Sat, 19 Mar 2022 19:24:09 +0000 (20:24 +0100)]
fix: Fix closure hints using macro ranges

2 years agoMerge #11755
bors[bot] [Sat, 19 Mar 2022 19:15:06 +0000 (19:15 +0000)]
Merge #11755

11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoChange skip trivial behaviour
Lukas Wirth [Sat, 19 Mar 2022 19:12:14 +0000 (20:12 +0100)]
Change skip trivial behaviour

2 years agoAdd option to skip trivial cases
Lukas Wirth [Sat, 19 Mar 2022 18:01:19 +0000 (19:01 +0100)]
Add option to skip trivial cases

2 years agoUse numbers for lifetimes by default, add setting to prefer using parameter names
Lukas Wirth [Sat, 19 Mar 2022 17:11:56 +0000 (18:11 +0100)]
Use numbers for lifetimes by default, add setting to prefer using parameter names

2 years agoMerge #11761
bors[bot] [Fri, 18 Mar 2022 19:30:52 +0000 (19:30 +0000)]
Merge #11761

11761: internal: Rename call info to "signature help" r=jonas-schievink a=jonas-schievink

It is no longer limited to just calls

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRename call info to "signature help"
Jonas Schievink [Fri, 18 Mar 2022 19:19:35 +0000 (20:19 +0100)]
Rename call info to "signature help"

It is no longer limited to just calls

2 years agoMerge #11760
bors[bot] [Fri, 18 Mar 2022 19:01:25 +0000 (19:01 +0000)]
Merge #11760

11760: feat: Provide signature help when editing generic args r=jonas-schievink a=jonas-schievink

![screenshot-2022-03-18-19:48:14](https://user-images.githubusercontent.com/1786438/159067106-3917a355-ca77-4d23-ad56-945dcc945425.png)

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoProvide signature help when editing generic args
Jonas Schievink [Fri, 18 Mar 2022 18:56:34 +0000 (19:56 +0100)]
Provide signature help when editing generic args

2 years agoFix test fixtures
Lukas Wirth [Fri, 18 Mar 2022 17:57:11 +0000 (18:57 +0100)]
Fix test fixtures

2 years agoGive the lifetimes better names
Lukas Wirth [Fri, 18 Mar 2022 17:55:03 +0000 (18:55 +0100)]
Give the lifetimes better names

2 years agofeat: Implement lifetime elision hints
Lukas Wirth [Fri, 18 Mar 2022 17:11:16 +0000 (18:11 +0100)]
feat: Implement lifetime elision hints

2 years agoMerge #11752
bors[bot] [Fri, 18 Mar 2022 16:38:32 +0000 (16:38 +0000)]
Merge #11752

11752: internal: Allow explicitly specifying end of fixture annotation r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Allow explicitly specifying end of fixture annotation
Lukas Wirth [Fri, 18 Mar 2022 14:30:58 +0000 (15:30 +0100)]
internal: Allow explicitly specifying end of fixture annotation

2 years agoMerge #11753
bors[bot] [Fri, 18 Mar 2022 14:37:59 +0000 (14:37 +0000)]
Merge #11753

11753: feat: Complete assoc const patterns on builtin types r=jonas-schievink a=jonas-schievink

followup to https://github.com/rust-analyzer/rust-analyzer/pull/11713

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoComplete assoc const patterns on builtin types
Jonas Schievink [Fri, 18 Mar 2022 14:34:31 +0000 (15:34 +0100)]
Complete assoc const patterns on builtin types

2 years agoMerge #11713
bors[bot] [Fri, 18 Mar 2022 13:54:09 +0000 (13:54 +0000)]
Merge #11713

11713: Complete associated consts in patterns  r=jonas-schievink a=hi-rustin

Try close https://github.com/rust-analyzer/rust-analyzer/issues/11555

Co-authored-by: hi-rustin <rustin.liu@gmail.com>
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2 years agoUpdate crates/ide_completion/src/tests/pattern.rs
Jonas Schievink [Fri, 18 Mar 2022 13:53:44 +0000 (14:53 +0100)]
Update crates/ide_completion/src/tests/pattern.rs

2 years agoMerge #11750
bors[bot] [Fri, 18 Mar 2022 11:13:37 +0000 (11:13 +0000)]
Merge #11750

11750: fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11746
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix runnables trying to add doc tests in the crate root from #[macro_export...
Lukas Wirth [Fri, 18 Mar 2022 10:55:53 +0000 (11:55 +0100)]
fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros

2 years agoMerge #11747
bors[bot] [Fri, 18 Mar 2022 07:19:42 +0000 (07:19 +0000)]
Merge #11747

11747: minor: Remove Update GitHub API token command r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRemove Update GitHub API token command
Laurențiu Nicola [Fri, 18 Mar 2022 07:19:02 +0000 (09:19 +0200)]
Remove Update GitHub API token command

2 years agoMerge #11744
bors[bot] [Thu, 17 Mar 2022 17:25:07 +0000 (17:25 +0000)]
Merge #11744

11744: Bump deps r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump deps
Laurențiu Nicola [Thu, 17 Mar 2022 17:10:45 +0000 (19:10 +0200)]
Bump deps

2 years agoMerge #11743
bors[bot] [Thu, 17 Mar 2022 16:28:21 +0000 (16:28 +0000)]
Merge #11743

11743: fix: Properly unify receivers during method resolution r=flodiebold a=flodiebold

This fixes our type inference problems with `DynMap`; the problem there were the projection types in
```rust
impl<P: Policy> KeyMap<Key<P::K, P::V, P>>
```
which messed up the naive type equality check we did. It also actually simplifies the logic though, IMO. I also added a fix for associated const resolution that I noticed (visibility not being taken into account).

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoMove fallback_bound_vars to the only place it's used now
Florian Diebold [Thu, 17 Mar 2022 16:08:43 +0000 (17:08 +0100)]
Move fallback_bound_vars to the only place it's used now

2 years agoFixes for consts
Florian Diebold [Thu, 17 Mar 2022 16:02:58 +0000 (17:02 +0100)]
Fixes for consts

2 years agoSnapshot obligations
Florian Diebold [Thu, 17 Mar 2022 13:29:39 +0000 (14:29 +0100)]
Snapshot obligations

2 years agoProperly try unifying the receivers during method resolution
Florian Diebold [Thu, 17 Mar 2022 11:39:42 +0000 (12:39 +0100)]
Properly try unifying the receivers during method resolution

Instead of hackily checking if they're equal.

2 years agoFix typo
hi-rustin [Thu, 17 Mar 2022 14:59:47 +0000 (22:59 +0800)]
Fix typo

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoAdd test for DynMap type inference
Florian Diebold [Sun, 13 Mar 2022 15:25:03 +0000 (16:25 +0100)]
Add test for DynMap type inference

2 years agoMatch the enum and union
hi-rustin [Thu, 17 Mar 2022 13:18:52 +0000 (21:18 +0800)]
Match the enum and union

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoMerge #11741
bors[bot] [Thu, 17 Mar 2022 13:23:22 +0000 (13:23 +0000)]
Merge #11741

11741: Emit #[must_use] in Generate enum is_variant assist r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11740
bors[bot] [Thu, 17 Mar 2022 13:14:26 +0000 (13:14 +0000)]
Merge #11740

11740: Insert #[must_use] in generate_is_empty_from_len r=lnicola a=Walther

Inserts `#[must_use]` for the generated `is_empty` methods. I also added the `#[must_use]` for the `len()` methods in the documentation examples and tests for this generator while at it, to make sure they too encourage the use of the annotation.

From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738

Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2 years agoEmit #[must_use] in Generate enum is_variant assist
Laurențiu Nicola [Thu, 17 Mar 2022 13:10:25 +0000 (15:10 +0200)]
Emit #[must_use] in Generate enum is_variant assist

2 years agoInsert #[must_use] in generate_is_empty_from_len
Walther [Thu, 17 Mar 2022 13:03:02 +0000 (15:03 +0200)]
Insert #[must_use] in generate_is_empty_from_len

2 years agoMerge #11737 #11739
bors[bot] [Thu, 17 Mar 2022 12:58:14 +0000 (12:58 +0000)]
Merge #11737 #11739

11737: Emit `#[must_use]` in `Generate new` assist r=lnicola a=lnicola

Closes #11736

11739: Insert #[must_use] in generate_getter r=lnicola a=Walther

Inserts `#[must_use]` for the generated getter methods.

From discussion in https://github.com/rust-analyzer/rust-analyzer/issues/11736 and https://github.com/rust-analyzer/rust-analyzer/pull/11738

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Co-authored-by: Walther <veeti.haapsamo@gmail.com>
2 years agoInsert #[must_use] in generate_getter
Walther [Thu, 17 Mar 2022 12:49:22 +0000 (14:49 +0200)]
Insert #[must_use] in generate_getter

2 years agoFix the wrong path resolution
hi-rustin [Wed, 16 Mar 2022 12:54:01 +0000 (20:54 +0800)]
Fix the wrong path resolution

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoAdd completes_associated_const test
hi-rustin [Tue, 15 Mar 2022 13:54:45 +0000 (21:54 +0800)]
Add completes_associated_const test

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoComplete associated consts in patterns
hi-rustin [Tue, 15 Mar 2022 13:14:02 +0000 (21:14 +0800)]
Complete associated consts in patterns

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2 years agoEmit #[must_use] in Generate new assist
Laurențiu Nicola [Thu, 17 Mar 2022 12:11:29 +0000 (14:11 +0200)]
Emit #[must_use] in Generate new assist

2 years agoMerge #11735
bors[bot] [Thu, 17 Mar 2022 09:23:26 +0000 (09:23 +0000)]
Merge #11735

11735: Fix const generic panic, again r=lnicola a=HKalbasi

fix https://github.com/rust-analyzer/rust-analyzer/pull/11734#issuecomment-1070526085

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agofix regression_11688_2
hkalbasi [Thu, 17 Mar 2022 09:15:04 +0000 (12:45 +0330)]
fix regression_11688_2

2 years agoMerge #11734
bors[bot] [Thu, 17 Mar 2022 06:54:27 +0000 (06:54 +0000)]
Merge #11734

11734: internal: Bump `xshell` and fix `dist` r=lnicola a=lnicola

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump xshell and fix dist
Laurențiu Nicola [Thu, 17 Mar 2022 06:53:33 +0000 (08:53 +0200)]
Bump xshell and fix dist

2 years agoMerge #11731
bors[bot] [Wed, 16 Mar 2022 20:31:47 +0000 (20:31 +0000)]
Merge #11731

11731: feat: Add return type hints for closures with block bodies r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11386
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofeat: Add return type hints for closures with block bodies
Lukas Wirth [Wed, 16 Mar 2022 20:16:55 +0000 (21:16 +0100)]
feat: Add return type hints for closures with block bodies

2 years agoMerge #11727
bors[bot] [Wed, 16 Mar 2022 19:56:31 +0000 (19:56 +0000)]
Merge #11727

11727: minor: Fix metrics.json path r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/pull/11724#issuecomment-1069047929

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoFix metrics.json path
Laurențiu Nicola [Wed, 16 Mar 2022 16:15:44 +0000 (18:15 +0200)]
Fix metrics.json path

2 years agoMerge #11694
bors[bot] [Wed, 16 Mar 2022 16:35:34 +0000 (16:35 +0000)]
Merge #11694

11694: fix: "Extract to function" assist preserves `break` and `continue` labels r=Veykril a=m0rg-dev

Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them.

This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec.

Closes #11413.

Co-authored-by: Morgan Thomas <corp@m0rg.dev>
2 years agoMerge #11726
bors[bot] [Wed, 16 Mar 2022 16:04:10 +0000 (16:04 +0000)]
Merge #11726

11726: internal: More ide_completion refactoring r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRevert omitting field completions
Lukas Wirth [Wed, 16 Mar 2022 15:41:35 +0000 (16:41 +0100)]
Revert omitting field completions

2 years agoRemove code duplication
Lukas Wirth [Wed, 16 Mar 2022 15:32:36 +0000 (16:32 +0100)]
Remove code duplication

2 years agoSimplify completion render functionality
Lukas Wirth [Wed, 16 Mar 2022 15:27:55 +0000 (16:27 +0100)]
Simplify completion render functionality

2 years agoRename compound things to variant things
Lukas Wirth [Wed, 16 Mar 2022 12:41:35 +0000 (13:41 +0100)]
Rename compound things to variant things

2 years agoMerge #11724
bors[bot] [Wed, 16 Mar 2022 11:12:09 +0000 (11:12 +0000)]
Merge #11724

11724: minor: unblock metrics r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: unblock metrics
Lukas Wirth [Wed, 16 Mar 2022 11:11:21 +0000 (12:11 +0100)]
minor: unblock metrics

2 years agoMerge #11720
bors[bot] [Wed, 16 Mar 2022 06:32:33 +0000 (06:32 +0000)]
Merge #11720

11720: fix: Mark chaining hints as types r=SomeoneToIgnore a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/pull/11445#discussion_r826863321

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMark chaining hints as types, since that's what they are
Laurențiu Nicola [Wed, 16 Mar 2022 05:46:09 +0000 (07:46 +0200)]
Mark chaining hints as types, since that's what they are

2 years agoMerge #11718
bors[bot] [Tue, 15 Mar 2022 20:27:51 +0000 (20:27 +0000)]
Merge #11718

11718: Fix const generic panic r=lnicola a=HKalbasi

fix https://github.com/rust-analyzer/rust-analyzer/pull/11688#issuecomment-1066824954

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agofix const generic panic
hkalbasi [Tue, 15 Mar 2022 19:04:05 +0000 (22:34 +0330)]
fix const generic panic

2 years agoMerge #11708
bors[bot] [Tue, 15 Mar 2022 18:05:27 +0000 (18:05 +0000)]
Merge #11708

11708: Update manual for inlay hint customization r=Veykril a=ian-h-chamberlain

Related to #6405, #6883 but not sure if they should be closed or not as this is just a documentation update.

This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.

Co-authored-by: Ian Chamberlain <ian-h-chamberlain@users.noreply.github.com>
2 years agoMerge #11714
bors[bot] [Tue, 15 Mar 2022 17:58:21 +0000 (17:58 +0000)]
Merge #11714

11714: fix: Fix completions not always working in for-loop patterns r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11205
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix completions not always working in for-loop patterns
Lukas Wirth [Tue, 15 Mar 2022 17:06:34 +0000 (18:06 +0100)]
fix: Fix completions not always working in for-loop patterns

2 years agoMerge #11710
bors[bot] [Tue, 15 Mar 2022 07:27:05 +0000 (07:27 +0000)]
Merge #11710

11710:  editors/code: fix crash due to missing ID= field r=lnicola a=cab404

Assuming ID=linux by default.
Also removed toLowerCase — it really shouldn't be needed.
Fixes #11709

Co-authored-by: Vladimir Serov <me@cab404.ru>
2 years agoeditors/code: fix crash due to missing ID= field
Vladimir Serov [Tue, 15 Mar 2022 03:52:03 +0000 (06:52 +0300)]
editors/code: fix crash due to missing ID= field

Assuming ID=linux in isNixOs by default. You can get away with
default "", but why do that if there's a default value in spec?)

Also removed toLowerCase — it really shouldn't be needed.
Fixes #11709

2 years agoUpdate manual for inlay hint customization
Ian Chamberlain [Mon, 14 Mar 2022 21:21:36 +0000 (17:21 -0400)]
Update manual for inlay hint customization

Closes #6883

This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.

2 years agoMerge #11707
bors[bot] [Mon, 14 Mar 2022 20:05:46 +0000 (20:05 +0000)]
Merge #11707

11707: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Mon, 14 Mar 2022 19:36:35 +0000 (20:36 +0100)]
Simplify

2 years agoMerge #11700
bors[bot] [Mon, 14 Mar 2022 15:02:34 +0000 (15:02 +0000)]
Merge #11700

11700: :arrow_up: xshell r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years ago:arrow_up: xshell
Aleksey Kladov [Sun, 13 Mar 2022 21:20:51 +0000 (21:20 +0000)]
:arrow_up: xshell

2 years agoMerge #11688
bors[bot] [Mon, 14 Mar 2022 11:15:00 +0000 (11:15 +0000)]
Merge #11688

11688: Add const generics r=HKalbasi a=HKalbasi

#7434 is not in this PR, so there is no evaluation of constants and no default const argument. But the rest (type inference and method resolution with chalk) should work.

Chalk is pedantic about kind of generic arguments, and will panic in case of mixing type and const arguments. I tried to add test that, but I'm not sure if it covers all cases.

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoAdd const generics
hkalbasi [Wed, 9 Mar 2022 18:50:24 +0000 (22:20 +0330)]
Add const generics

2 years agotest: Make imported_external test that the full path is replaced
Steven Joruk [Sun, 13 Mar 2022 13:25:06 +0000 (13:25 +0000)]
test: Make imported_external test that the full path is replaced

2 years agoMerge #11696
bors[bot] [Sun, 13 Mar 2022 09:25:55 +0000 (09:25 +0000)]
Merge #11696

11696: editors/code: fix nixos detection r=lnicola a=cab404

Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695

Closes #11695

Co-authored-by: Vladimir Serov <me@cab404.ru>
2 years agoeditors/code: fix nixos detection
Vladimir Serov [Sat, 12 Mar 2022 21:26:36 +0000 (00:26 +0300)]
editors/code: fix nixos detection

Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695
Closes #11695

2 years agobroke a test trying to make the diff look better...
Morgan Thomas [Sat, 12 Mar 2022 18:35:26 +0000 (10:35 -0800)]
broke a test trying to make the diff look better...

2 years agofix: "Extract to function" assist preserves `break` and `continue` labels
Morgan Thomas [Sat, 12 Mar 2022 16:44:37 +0000 (08:44 -0800)]
fix: "Extract to function" assist preserves `break` and `continue` labels

Adds a label / lifetime parameter to `ide_assists::handlers::extract_function::FlowKind::{Break, Continue}`, adds support for emitting labels to `syntax::ast::make::{expr_break, expr_continue}`, and implements the required machinery to let `extract_function` make use of them.

This does modify the external API of the `syntax` crate, but the changes there are simple, not used outside `ide_assists`, and, well, we should probably support emitting `break` and `continue` labels through `syntax` anyways, they're part of the language spec.

Closes #11413.

2 years agochore: Remove unused import
Steven Joruk [Sat, 12 Mar 2022 15:59:00 +0000 (15:59 +0000)]
chore: Remove unused import

2 years agorefactor: Veykril's code review suggestions
Steven Joruk [Sat, 12 Mar 2022 15:10:16 +0000 (15:10 +0000)]
refactor: Veykril's code review suggestions