]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoMerge #11866
bors[bot] [Sun, 3 Apr 2022 11:49:23 +0000 (11:49 +0000)]
Merge #11866

11866: fix: Prevent underflow in range conversion  r=Veykril a=skyfmmf

Previously, when line numbers of Rust spans were converted to LSP ranges, they could underflow resulting in very large line numbers. As an underflow is always wrong, prevent it and use 0 instead.

This was noticed when opening an empty file in `src/bin/` of a library crate. In this case rustc produces a span with `"line_start": 0, "line_end": 0` resulting in the underflow.

Co-authored-by: Felix Maurer <felix@felix-maurer.de>
2 years agoMerge #11886
bors[bot] [Sun, 3 Apr 2022 11:13:46 +0000 (11:13 +0000)]
Merge #11886

11886: add test for postfix completion relevance r=matklad a=matklad

Follow up to #11857, add a test and cov-marks

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years agoadd test for postfix completion relevance
Aleksey Kladov [Sun, 3 Apr 2022 11:09:55 +0000 (12:09 +0100)]
add test for postfix completion relevance

Follow up to #11857, add a test and cov-marks

2 years agoMerge #11821
bors[bot] [Sun, 3 Apr 2022 07:14:14 +0000 (07:14 +0000)]
Merge #11821

11821: minor: Bump npm deps r=lnicola a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMerge #11879
bors[bot] [Sun, 3 Apr 2022 07:05:41 +0000 (07:05 +0000)]
Merge #11879

11879: Suggest infered type in auto complete r=HKalbasi a=HKalbasi

fix #11855

It doesn't work for return types and consts (so their tests are failing) because I can't find their body node in the original file. (Are these original and fake file documented somewhere?)

Also it currently needs to type first character of the type (or manual ctrl+space) to open the auto complete panel, is it possible to open it automatically on typing `:` and `->`?

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoLoad @hpcc-js/wasm as a script, not worker
Laurențiu Nicola [Sun, 3 Apr 2022 07:05:36 +0000 (10:05 +0300)]
Load @hpcc-js/wasm as a script, not worker

2 years agosuggest infered type in auto complete
hkalbasi [Sat, 2 Apr 2022 11:49:36 +0000 (16:19 +0430)]
suggest infered type in auto complete

2 years agoMerge #11877
bors[bot] [Sat, 2 Apr 2022 22:12:59 +0000 (22:12 +0000)]
Merge #11877

11877: fix: splitting path of a glob import wrongly adds `self` r=Veykril a=iDawer

Close  #11703

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2 years agoMerge #11882
bors[bot] [Sat, 2 Apr 2022 14:19:38 +0000 (14:19 +0000)]
Merge #11882

11882: internal: Record outline child modules with missing backing file in def map r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: outline child modules with missing backing file
Lukas Wirth [Sat, 2 Apr 2022 14:14:19 +0000 (16:14 +0200)]
internal: outline child modules with missing backing file

2 years agoMerge #11881
bors[bot] [Sat, 2 Apr 2022 13:40:08 +0000 (13:40 +0000)]
Merge #11881

11881: fix: Don't rely on lang items to find primitive impls r=flodiebold a=flodiebold

rustc has removed the use of lang items to mark the primitive impls, so just look through the crate graph for them (this should be fine performance-wise since we cache the crates that contain these impls).

Fixes #11876.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Don't rely on lang items to find primitive impls
Florian Diebold [Sat, 2 Apr 2022 13:32:40 +0000 (15:32 +0200)]
fix: Don't rely on lang items to find primitive impls

rustc has removed the use of lang items to mark the primitive impls, so
just look through the crate graph for them (this should be fine
performance-wise since we cache the crates that contain these impls).

Fixes #11876.

2 years agoMerge #11878
bors[bot] [Sat, 2 Apr 2022 12:41:14 +0000 (12:41 +0000)]
Merge #11878

11878: fix: Paper over GAT panic r=flodiebold a=flodiebold

TIL that Chalk expects the arguments to a generic associated type to come *before* the ones for the parent trait, not *after* as we have been doing with all other nested generics. Fixing this requires a larger refactoring, so for now this just papers over the problem by completely ignoring parameters of associated types.

Fixes #11769.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Paper over GAT panic
Florian Diebold [Sat, 2 Apr 2022 11:04:04 +0000 (13:04 +0200)]
fix: Paper over GAT panic

TIL that Chalk expects the arguments to a generic associated type to
come *before* the ones for the parent trait, not *after* as we have been
doing with all other nested generics. Fixing this requires a larger
refactoring, so for now this just papers over the problem by completely
ignoring parameters of associated types.

Fixes #11769.

2 years agofix: `merge_imports::recursive_merge` exiting early
iDawer [Sat, 2 Apr 2022 09:18:42 +0000 (14:18 +0500)]
fix: `merge_imports::recursive_merge` exiting early

2 years agoMerge #11875
bors[bot] [Fri, 1 Apr 2022 23:43:28 +0000 (23:43 +0000)]
Merge #11875

11875: internal: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify completion import insertion
Lukas Wirth [Fri, 1 Apr 2022 23:42:21 +0000 (01:42 +0200)]
Simplify completion import insertion

2 years agoCleanup relevance scoring
Lukas Wirth [Fri, 1 Apr 2022 23:19:33 +0000 (01:19 +0200)]
Cleanup relevance scoring

2 years agoMerge #11857
bors[bot] [Fri, 1 Apr 2022 21:42:54 +0000 (21:42 +0000)]
Merge #11857

11857: Lower postfix suggestions in completions list r=Veykril a=avrong

Fixes #11850

Adds a parameter for postfix suggestions in `CompletionRelevance`, and basing on it, decreases relevance score of such items in completion list

Co-authored-by: Aleksei Trifonov <avrong@avrong.me>
2 years agoMerge #11874
bors[bot] [Fri, 1 Apr 2022 21:30:32 +0000 (21:30 +0000)]
Merge #11874

11874: minor: enum variant wording r=Veykril a=jakevossen5

As discussed on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/generate.20_.20for.20.22an.20enum.20variant.22

Co-authored-by: Jake Vossen <jake@vossen.dev>
2 years agoenum variant wording
Jake Vossen [Fri, 1 Apr 2022 20:22:49 +0000 (14:22 -0600)]
enum variant wording

2 years agoIntroduce postfix item types
Aleksei Trifonov [Fri, 1 Apr 2022 17:50:27 +0000 (20:50 +0300)]
Introduce postfix item types

2 years agoMerge #11872
bors[bot] [Fri, 1 Apr 2022 17:12:44 +0000 (17:12 +0000)]
Merge #11872

11872: internal: Remove `PathResolution::AssocItem` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Remove `PathResolution::AssocItem`
Lukas Wirth [Fri, 1 Apr 2022 16:32:05 +0000 (18:32 +0200)]
internal: Remove `PathResolution::AssocItem`

2 years agoMerge #11796
bors[bot] [Fri, 1 Apr 2022 15:51:29 +0000 (15:51 +0000)]
Merge #11796

11796: minor: Remove sponsors from readme files r=Veykril a=Veykril

No need to merge this now though

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11870
bors[bot] [Fri, 1 Apr 2022 15:33:01 +0000 (15:33 +0000)]
Merge #11870

11870: Recover from missing type annotation r=Veykril a=HKalbasi

We were missing the init expression in case of `let x: = 2`, which breaks type inference of that variable (previously x were `{unknown}`, now it is `i32`).

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoMerge #11871
bors[bot] [Fri, 1 Apr 2022 15:17:03 +0000 (15:17 +0000)]
Merge #11871

11871: internal: Move `rust.ungram` into `rust-analyzer/crates/syntax` r=Veykril a=Veykril

This makes updating the grammar a lot simpler for us. Though removing it from ungrammar can't be done without bumping it to 2.0 so I'll leave it in there for the time being.
cc https://github.com/rust-analyzer/ungrammar/pull/47

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Move rust.ungram into rust-analyzer/crates/syntax
Lukas Wirth [Fri, 1 Apr 2022 15:12:25 +0000 (17:12 +0200)]
internal: Move rust.ungram into rust-analyzer/crates/syntax

2 years agofix: splitting path of a glob import wrongly adds `self`
iDawer [Fri, 1 Apr 2022 14:12:50 +0000 (19:12 +0500)]
fix: splitting path of a glob import wrongly adds `self`

`ast::UseTree::split_prefix` handles globs now.
Removed an extra branch for globs in `ide_db::imports::merge_imports::recursive_merge` (superseeded by split_prefix).

2 years agorecover from missing type annotation
hkalbasi [Fri, 1 Apr 2022 12:50:54 +0000 (17:20 +0430)]
recover from missing type annotation

2 years agoMerge #11869
bors[bot] [Fri, 1 Apr 2022 12:40:51 +0000 (12:40 +0000)]
Merge #11869

11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal

The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.

<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png">

But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. đź™‡đźŹ»â€Ťâ™‚️

Before:

<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png">

After:

<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png">

Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2 years agoCode blocks with tilde also works like code block
Lee Dogeon [Fri, 1 Apr 2022 06:22:32 +0000 (15:22 +0900)]
Code blocks with tilde also works like code block

2 years agoMerge #11867
bors[bot] [Fri, 1 Apr 2022 10:18:15 +0000 (10:18 +0000)]
Merge #11867

11867: create generate is, as, try_into group r=Veykril a=jakevossen5

Fixes #11636

In `generate_enum_projection_method.rs`, the changes to the function are from `cargo fmt`, I made the same change as I did in `generate_enum_is_method.rs`.

Co-authored-by: Jake Vossen <jake@vossen.dev>
2 years agocreate generate is, as, try_into group
Jake Vossen [Fri, 1 Apr 2022 03:19:45 +0000 (21:19 -0600)]
create generate is, as, try_into group

2 years agoAdd test against line number underflow
Felix Maurer [Thu, 31 Mar 2022 21:37:23 +0000 (23:37 +0200)]
Add test against line number underflow

2 years agoPrevent underflow when converting line numbers
Felix Maurer [Thu, 31 Mar 2022 21:00:48 +0000 (23:00 +0200)]
Prevent underflow when converting line numbers

Previously, when line numbers of Rust spans were converted to LSP
ranges, they could underflow resulting in very large line numbers. As
an underflow is always wrong, prevent it and use 0 instead.

2 years agoMerge #11863
bors[bot] [Thu, 31 Mar 2022 14:04:38 +0000 (14:04 +0000)]
Merge #11863

11863: fix: allow varargs in any param position r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3578 and aligns us with the Rust reference.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRemove parser restriction on varargs positioning
Jonas Schievink [Thu, 31 Mar 2022 14:03:27 +0000 (16:03 +0200)]
Remove parser restriction on varargs positioning

2 years agoMerge #11827
bors[bot] [Thu, 31 Mar 2022 13:01:10 +0000 (13:01 +0000)]
Merge #11827

11827: internal: Enforce Invariant that Resolver always contains a ModuleScope r=Veykril a=Veykril

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11861
bors[bot] [Thu, 31 Mar 2022 12:52:11 +0000 (12:52 +0000)]
Merge #11861

11861: internal: Add "view file text" command to debug sync issues r=jonas-schievink a=jonas-schievink

I saw a file sync bug the other day but didn't know how to further debug it. This command might give a clue as to what's wrong and help debug issues like https://github.com/rust-analyzer/rust-analyzer/issues/4829.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoAdd "view file text" command to debug sync issues
Jonas Schievink [Thu, 31 Mar 2022 12:50:33 +0000 (14:50 +0200)]
Add "view file text" command to debug sync issues

2 years agointernal: Enforce Resolver to always have a module scope
Lukas Wirth [Thu, 31 Mar 2022 09:12:08 +0000 (11:12 +0200)]
internal: Enforce Resolver to always have a module scope

2 years agoFix formatting
Aleksei Trifonov [Wed, 30 Mar 2022 23:59:15 +0000 (02:59 +0300)]
Fix formatting

2 years agoLower postfix suggestions in completions list
Aleksei Trifonov [Wed, 30 Mar 2022 23:27:33 +0000 (02:27 +0300)]
Lower postfix suggestions in completions list

2 years agointernal: Refactor FamousDefs builtin crate search
Lukas Wirth [Sat, 26 Mar 2022 20:22:35 +0000 (21:22 +0100)]
internal: Refactor FamousDefs builtin crate search

2 years agoMerge #11852
bors[bot] [Wed, 30 Mar 2022 13:48:50 +0000 (13:48 +0000)]
Merge #11852

11852: Type mismatch when last expression is noreturn asm r=lnicola a=weirdsmiley

When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.

Fixes: [#11820](https://github.com/rust-analyzer/rust-analyzer/issues/11820)
Co-authored-by: Manas <manas18244@iiitd.ac.in>
2 years agoType mismatch when last expression is noreturn asm
Manas [Wed, 30 Mar 2022 13:32:27 +0000 (19:02 +0530)]
Type mismatch when last expression is noreturn asm

When last expression in a function body is noreturn asm, then analyzer
complains about the type mismatch by highlighting entire body. This
fixes it by introducing loop {} in the expanded code.

2 years agoMerge #11849
bors[bot] [Wed, 30 Mar 2022 11:52:50 +0000 (11:52 +0000)]
Merge #11849

11849: docs(auto_import): change by_self -> self and by_crate -> crate r=Veykril a=gibfahn

---

#### Commits _(oldest to newest)_

6b38c2d75 docs(auto_import): change by_self -> self and by_crate -> crate

Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.

<br/>

Co-authored-by: Gibson Fahnestock <gibfahn@gmail.com>
2 years agodocs(auto_import): change by_self -> self and by_crate -> crate
Gibson Fahnestock [Wed, 30 Mar 2022 10:45:14 +0000 (11:45 +0100)]
docs(auto_import): change by_self -> self and by_crate -> crate

Keep things consistent with the package.json , which uses `self` and
`crate` instead of `by_self` and `by_crate`. Both names are in fact
allowed as aliases, but we should be consistent so that people reading
the docs and using a schema do not see red squiggles.

2 years agoMerge #11844
bors[bot] [Tue, 29 Mar 2022 19:58:14 +0000 (19:58 +0000)]
Merge #11844

11844: Fix divergence detection for bare match arms r=flodiebold a=flodiebold

Fixes #11814 and #11837.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix divergence detection for bare match arms
Florian Diebold [Tue, 29 Mar 2022 19:55:34 +0000 (21:55 +0200)]
Fix divergence detection for bare match arms

Fixes #11814 and #11837.

2 years agoMerge #11842
bors[bot] [Tue, 29 Mar 2022 16:10:20 +0000 (16:10 +0000)]
Merge #11842

11842: Fix duplicate type mismatches with blocks r=flodiebold a=flodiebold

E.g. when there's a type mismatch on the return value of a function. To fix this, we have to return the expected type as the type of the block when there's a mismatch. That meant some IDE code that expected otherwise had to be adapted, in particular the "add return type" assist. For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied in all branches of an if expression at the same time anymore, because there's a type mismatch for each branch that has the wrong type.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix duplicate type mismatches with blocks
Florian Diebold [Tue, 29 Mar 2022 15:51:11 +0000 (17:51 +0200)]
Fix duplicate type mismatches with blocks

E.g. when there's a type mismatch on the return value of a function. To
fix this, we have to return the expected type as the type of the block
when there's a mismatch. That meant some IDE code that expected
otherwise had to be adapted, in particular the "add return type" assist.
For the "wrap in Ok/Some" quickfix, this sadly means it usually can't be applied
in all branches of an if expression at the same time anymore, because
there's a type mismatch for each branch that has the wrong type.

2 years agoMerge #11840
bors[bot] [Tue, 29 Mar 2022 10:55:17 +0000 (10:55 +0000)]
Merge #11840

11840: Fix another const generic panic r=flodiebold a=HKalbasi

fix #11835

If I change `dyn` to `impl` in the test, it will infer the type as `IntoIterator::Item<impl Iterator<Item = [Ar<u8, 7>; 9]> + ?Sized>` instead of `[Ar<u8, 7>; 9]`. Maybe it needs some action?

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agofix regression_11688_3
hkalbasi [Tue, 29 Mar 2022 06:33:55 +0000 (11:03 +0430)]
fix regression_11688_3

2 years agoMerge #11833
bors[bot] [Sun, 27 Mar 2022 17:22:02 +0000 (17:22 +0000)]
Merge #11833

11833: internal: Move mismatched arg count diagnostic to inference r=flodiebold a=flodiebold

This means we only need to handle legacy const generics in one place, and it fits there especially since there will be more diagnostics coming.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoRemove legacy_const_generics_indices from CallableSig
Florian Diebold [Sun, 27 Mar 2022 17:12:00 +0000 (19:12 +0200)]
Remove legacy_const_generics_indices from CallableSig

I want to remove CallableSig anyway, and it's not needed anymore.

2 years agoMove mismatched-arg-count diagnostic to inference
Florian Diebold [Sun, 27 Mar 2022 17:10:31 +0000 (19:10 +0200)]
Move mismatched-arg-count diagnostic to inference

2 years agoMerge #11832
bors[bot] [Sun, 27 Mar 2022 13:46:35 +0000 (13:46 +0000)]
Merge #11832

11832: Fix typo in the style documentation r=lnicola a=Therzok

Was going through the documentation itself and found this typo just waiting to be fixed

Co-authored-by: Marius Ungureanu <therzok@gmail.com>
2 years agoFix typo in the style documentation
Marius Ungureanu [Sun, 27 Mar 2022 12:23:33 +0000 (15:23 +0300)]
Fix typo in the style documentation

Was going through the documentation itself and found this typo just waiting to be fixed

2 years agoMerge #11831
bors[bot] [Sun, 27 Mar 2022 10:52:27 +0000 (10:52 +0000)]
Merge #11831

11831: fix: Disable ref_match for qualified paths as well r=flodiebold a=flodiebold

I.e. don't suggest `Foo::&foo()`.

CC #8058.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agofix: Disable ref_match for qualified paths as well
Florian Diebold [Sun, 27 Mar 2022 10:50:16 +0000 (12:50 +0200)]
fix: Disable ref_match for qualified paths as well

I.e. don't suggest `Foo::&foo()`.

CC #8058.

2 years agoMerge #11829
bors[bot] [Sun, 27 Mar 2022 07:12:06 +0000 (07:12 +0000)]
Merge #11829

11829: minor: Bump chalk r=lnicola a=lnicola

Pulls in https://github.com/rust-lang/chalk/pull/759.

bors r+

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoBump chalk
Laurențiu Nicola [Sun, 27 Mar 2022 07:11:02 +0000 (10:11 +0300)]
Bump chalk

2 years agoMerge #11825
bors[bot] [Sat, 26 Mar 2022 18:49:41 +0000 (18:49 +0000)]
Merge #11825

11825: fix: Don't complete `Drop::drop` for qualified paths r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoMerge #11826
bors[bot] [Sat, 26 Mar 2022 18:40:39 +0000 (18:40 +0000)]
Merge #11826

11826: Revert "Emit #[must_use] in Generate new assist" r=lnicola a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/pull/11737#issuecomment-1079740305

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoRevert "Emit #[must_use] in Generate new assist"
Laurențiu Nicola [Sat, 26 Mar 2022 18:39:36 +0000 (20:39 +0200)]
Revert "Emit #[must_use] in Generate new assist"

This reverts commit 7e05e10495cd0f83cbcba2e7d881b616998cf7dc.

2 years agoSort runnable test results to make them deterministic
Lukas Wirth [Sat, 26 Mar 2022 18:38:20 +0000 (19:38 +0100)]
Sort runnable test results to make them deterministic

2 years agofix: Don't complete Drop::drop for qualified paths
Lukas Wirth [Sat, 26 Mar 2022 17:46:49 +0000 (18:46 +0100)]
fix: Don't complete Drop::drop for qualified paths

2 years agoSimplify
Lukas Wirth [Wed, 23 Mar 2022 17:09:53 +0000 (18:09 +0100)]
Simplify

2 years agoMerge #11793
bors[bot] [Fri, 25 Mar 2022 22:46:15 +0000 (22:46 +0000)]
Merge #11793

11793: LSIF: consolidate references into a single edge where possible. r=Veykril a=khuey

Co-authored-by: Kyle Huey <khuey@kylehuey.com>
2 years agoBump npm deps
Laurențiu Nicola [Fri, 25 Mar 2022 18:25:37 +0000 (20:25 +0200)]
Bump npm deps

2 years agoMerge #11817
bors[bot] [Fri, 25 Mar 2022 15:26:10 +0000 (15:26 +0000)]
Merge #11817

11817: minor: fix comment r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoMerge #11809
bors[bot] [Fri, 25 Mar 2022 15:11:56 +0000 (15:11 +0000)]
Merge #11809

11809: feat: disable experimental diagnostics by default r=jonas-schievink a=jonas-schievink

Now that we diagnose type mismatches, we have another diagnostic that can potentially produce false positives, so let's disable experimental diagnostics by default.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agofix comment
Jonas Schievink [Fri, 25 Mar 2022 14:30:52 +0000 (15:30 +0100)]
fix comment

2 years agoMerge #11810
bors[bot] [Thu, 24 Mar 2022 17:27:18 +0000 (17:27 +0000)]
Merge #11810

11810: internal: rename the 1.47 proc macro ABI to 1.48 r=jonas-schievink a=jonas-schievink

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

We don't support 1.47, so rename it to reflect that.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoRename the 1.47 ABI to 1.48
Jonas Schievink [Thu, 24 Mar 2022 17:26:10 +0000 (18:26 +0100)]
Rename the 1.47 ABI to 1.48

2 years agoDisable experimental diagnostics by default
Jonas Schievink [Thu, 24 Mar 2022 15:57:50 +0000 (16:57 +0100)]
Disable experimental diagnostics by default

2 years agoMerge #11772
bors[bot] [Thu, 24 Mar 2022 09:42:09 +0000 (09:42 +0000)]
Merge #11772

11772: Support constants in const eval r=HKalbasi a=HKalbasi

This PR enables evaluating things like this:
```rust
const X: usize = 2;
const Y: usize = 3 + X; // = 5
```
My target was nalgebra's `U5`, `U22`, ... which are defined as `type U5 = Const<{ SomeType5::SOME_ASSOC_CONST }>` but I didn't find out how to find the `ConstId` of the implementation of the trait, not the trait itself (possibly related to #4558 ? We can find associated type alias, so maybe this is doable already) So it doesn't help for nalgebra currently, but it is useful anyway.

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agouse pat_id instead of name in const eval stack
hkalbasi [Thu, 24 Mar 2022 09:06:37 +0000 (13:36 +0430)]
use pat_id instead of name in const eval stack

2 years agoorganize const eval tests
hkalbasi [Thu, 24 Mar 2022 08:36:27 +0000 (13:06 +0430)]
organize const eval tests

2 years agoSupport constants in const eval
hkalbasi [Sun, 20 Mar 2022 13:45:28 +0000 (17:15 +0330)]
Support constants in const eval

2 years agoMerge #11806
bors[bot] [Wed, 23 Mar 2022 22:45:44 +0000 (22:45 +0000)]
Merge #11806

11806: fix: Fix async block type inference using containing function return type r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11804
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/11798#issuecomment-1076880521

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix async block type inference using containing function return type
Lukas Wirth [Wed, 23 Mar 2022 22:39:35 +0000 (23:39 +0100)]
fix: Fix async block type inference using containing function return type

2 years agoMerge #11802
bors[bot] [Wed, 23 Mar 2022 20:58:45 +0000 (20:58 +0000)]
Merge #11802

11802: fix: add stubs to make proc macros work that use the `SourceFile` API r=jonas-schievink a=jonas-schievink

Helps with the rocket 0.4 macros, at least on some Rust versions.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11264

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoMerge #11805
bors[bot] [Wed, 23 Mar 2022 20:20:09 +0000 (20:20 +0000)]
Merge #11805

11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold

Fixes #10454, and some type mismatches.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2 years agoFix filter_map in minicore
Florian Diebold [Wed, 23 Mar 2022 18:47:11 +0000 (19:47 +0100)]
Fix filter_map in minicore

2 years agoAdjust value in syntax highlighting benchmark
Florian Diebold [Wed, 23 Mar 2022 18:28:01 +0000 (19:28 +0100)]
Adjust value in syntax highlighting benchmark

2 years agoDon't try to resolve methods on unknown types
Florian Diebold [Wed, 23 Mar 2022 18:18:12 +0000 (19:18 +0100)]
Don't try to resolve methods on unknown types

Fixes #10454, and some type mismatches.

2 years agoStub out `SourceFile` related proc macro functions
Jonas Schievink [Wed, 23 Mar 2022 15:11:05 +0000 (16:11 +0100)]
Stub out `SourceFile` related proc macro functions

2 years agoMerge #11801
bors[bot] [Wed, 23 Mar 2022 14:11:42 +0000 (14:11 +0000)]
Merge #11801

11801: fix: avoid returning `None` from `Span::join` to fix some proc macros r=jonas-schievink a=jonas-schievink

Some proc macros, notably rocket, `.unwrap()` the result of `Span::join` (and correctly so, it should never be `None`). We don't have a proper implementation of that API, so we always returned `None`. This changes our stub impl to return the first span instead.

Does not fully fix rocket's macros, they need other stuff to work too.

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoReturn the first span from `Span::join`
Jonas Schievink [Wed, 23 Mar 2022 14:09:39 +0000 (15:09 +0100)]
Return the first span from `Span::join`

2 years agoMerge #11800
bors[bot] [Wed, 23 Mar 2022 13:34:49 +0000 (13:34 +0000)]
Merge #11800

11800: fix: fix `#[macro_use]` no longer importing non-`macro_rules!` macros r=jonas-schievink a=jonas-schievink

https://github.com/rust-analyzer/rust-analyzer/pull/11663 introduced a regression tracked in https://github.com/rust-analyzer/rust-analyzer/issues/11781, this fixes it.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11781

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agofix: properly import all types of macros with #[macro_use] again
Jonas Schievink [Wed, 23 Mar 2022 13:30:04 +0000 (14:30 +0100)]
fix: properly import all types of macros with #[macro_use] again

2 years agoMerge #11799
bors[bot] [Wed, 23 Mar 2022 12:55:48 +0000 (12:55 +0000)]
Merge #11799

11799: minor: Fix typo in `abi_1_57/mod.rs` comment r=lnicola a=WaffleLapkin

Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2 years agoFix typo in `abi_1_57/mod.rs` comment
Waffle Maybe [Wed, 23 Mar 2022 12:48:25 +0000 (16:48 +0400)]
Fix typo in `abi_1_57/mod.rs` comment

2 years agoMerge #11797
bors[bot] [Wed, 23 Mar 2022 11:23:07 +0000 (11:23 +0000)]
Merge #11797

11797: fix: fix "unwrap on a `None` value" in proc macros built with Rust 1.57.0 r=jonas-schievink a=jonas-schievink

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

cc https://github.com/rust-analyzer/rust-analyzer/pull/10769#issuecomment-1076251859

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agoIntroduce new fixed proc macro ABI for 1.57.0
Jonas Schievink [Wed, 23 Mar 2022 11:20:00 +0000 (12:20 +0100)]
Introduce new fixed proc macro ABI for 1.57.0

2 years agoMerge #11791
bors[bot] [Wed, 23 Mar 2022 00:36:11 +0000 (00:36 +0000)]
Merge #11791

11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2 years agominor: Remove sponsors from readme files
Lukas Wirth [Tue, 22 Mar 2022 21:47:15 +0000 (22:47 +0100)]
minor: Remove sponsors from readme files