Commit Graph

21416 Commits

Author SHA1 Message Date
Florian Diebold
ea1d0bccef Fix divergence detection for bare match arms
Fixes #11814 and #11837.
2022-03-29 21:56:49 +02:00
bors[bot]
9eb7553d5a
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>
2022-03-29 16:10:20 +00:00
Florian Diebold
0c4bdd2f32 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.
2022-03-29 18:06:52 +02:00
bors[bot]
89d495eb30
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>
2022-03-29 10:55:17 +00:00
hkalbasi
4fe0545bb6 fix regression_11688_3 2022-03-29 11:03:55 +04:30
bors[bot]
bc08b8eff3
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>
2022-03-27 17:22:02 +00:00
Florian Diebold
c2a31bfbb8 Remove legacy_const_generics_indices from CallableSig
I want to remove CallableSig anyway, and it's not needed anymore.
2022-03-27 19:21:09 +02:00
Florian Diebold
2be7e26d7d Move mismatched-arg-count diagnostic to inference 2022-03-27 19:21:09 +02:00
bors[bot]
837901a4a6
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>
2022-03-27 13:46:35 +00:00
Marius Ungureanu
b70fa1c717
Fix typo in the style documentation
Was going through the documentation itself and found this typo just waiting to be fixed
2022-03-27 15:23:33 +03:00
bors[bot]
f89529eb47
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>
2022-03-27 10:52:27 +00:00
Florian Diebold
9a427839fa fix: Disable ref_match for qualified paths as well
I.e. don't suggest `Foo::&foo()`.

CC #8058.
2022-03-27 12:50:55 +02:00
bors[bot]
02dd3168ef
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>
2022-03-27 07:12:06 +00:00
Laurențiu Nicola
85f797f59c Bump chalk 2022-03-27 10:11:02 +03:00
bors[bot]
4d05d29fad
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>
2022-03-26 18:49:41 +00:00
bors[bot]
630d85f8d1
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>
2022-03-26 18:40:39 +00:00
Laurențiu Nicola
03cb7d9448 Revert "Emit #[must_use] in Generate new assist"
This reverts commit 7e05e10495.
2022-03-26 20:39:36 +02:00
Lukas Wirth
0ae795136d Sort runnable test results to make them deterministic 2022-03-26 19:38:20 +01:00
Lukas Wirth
9b046d1051 fix: Don't complete Drop::drop for qualified paths 2022-03-26 18:46:49 +01:00
Lukas Wirth
e55ed52003 Simplify 2022-03-26 18:37:40 +01:00
bors[bot]
e30747dfa8
Merge #11793
11793: LSIF: consolidate references into a single edge where possible. r=Veykril a=khuey



Co-authored-by: Kyle Huey <khuey@kylehuey.com>
2022-03-25 22:46:15 +00:00
bors[bot]
68dfda6e48
Merge #11817
11817: minor: fix comment r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-25 15:26:10 +00:00
bors[bot]
903d3bc4f7
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>
2022-03-25 15:11:56 +00:00
Jonas Schievink
755aaf6feb fix comment 2022-03-25 15:30:52 +01:00
bors[bot]
d64f455e88
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>
2022-03-24 17:27:18 +00:00
Jonas Schievink
ea0325b2da Rename the 1.47 ABI to 1.48 2022-03-24 18:26:10 +01:00
Jonas Schievink
44a99d6e49 Disable experimental diagnostics by default 2022-03-24 17:00:17 +01:00
bors[bot]
f3d1a53fa6
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>
2022-03-24 09:42:09 +00:00
hkalbasi
bf4a1e4842 use pat_id instead of name in const eval stack 2022-03-24 13:36:37 +04:30
hkalbasi
22eaee25b8 organize const eval tests 2022-03-24 13:20:35 +04:30
hkalbasi
0e2989e421 Support constants in const eval 2022-03-24 13:09:22 +04:30
bors[bot]
b8e1d09b90
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>
2022-03-23 22:45:44 +00:00
Lukas Wirth
ed0c62597f fix: Fix async block type inference using containing function return type 2022-03-23 23:43:04 +01:00
bors[bot]
15fdb95183
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>
2022-03-23 20:58:45 +00:00
bors[bot]
75fada4aab
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>
2022-03-23 20:20:09 +00:00
Florian Diebold
e0e6bfb924 Fix filter_map in minicore 2022-03-23 19:47:11 +01:00
Florian Diebold
fa923f9b19 Adjust value in syntax highlighting benchmark 2022-03-23 19:28:01 +01:00
Florian Diebold
8d98f3c983 Don't try to resolve methods on unknown types
Fixes #10454, and some type mismatches.
2022-03-23 19:18:12 +01:00
Jonas Schievink
ef8365b1ae Stub out SourceFile related proc macro functions 2022-03-23 16:11:05 +01:00
bors[bot]
de5925da5c
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>
2022-03-23 14:11:42 +00:00
Jonas Schievink
1e2a4c1bdb Return the first span from Span::join 2022-03-23 15:09:39 +01:00
bors[bot]
83b4329c6f
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>
2022-03-23 13:34:49 +00:00
Jonas Schievink
18ad750786 fix: properly import all types of macros with #[macro_use] again 2022-03-23 14:34:27 +01:00
bors[bot]
0b3daef537
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>
2022-03-23 12:55:48 +00:00
Waffle Maybe
c8762a17fd
Fix typo in abi_1_57/mod.rs comment 2022-03-23 16:48:25 +04:00
bors[bot]
cdd14779b2
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>
2022-03-23 11:23:07 +00:00
Jonas Schievink
40856f01a1 Introduce new fixed proc macro ABI for 1.57.0 2022-03-23 12:20:00 +01:00
bors[bot]
652233283b
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>
2022-03-23 00:36:11 +00:00
bors[bot]
c2ea378920
Merge #11795
11795: fix: Correctly suggest auto importing traits from aliases r=Veykril a=unexge

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

Co-authored-by: unexge <unexge@gmail.com>
2022-03-22 21:44:06 +00:00
unexge
4e4c9ea4ac fix: Correctly suggest auto importing traits from aliases 2022-03-22 22:30:29 +01:00