Commit graph

14727 commits

Author SHA1 Message Date
Felix Maurer
a98ffe4268 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.
2022-03-31 23:00:48 +02:00
Jonas Schievink
42ecf406e8 Remove parser restriction on varargs positioning 2022-03-31 16:03:27 +02:00
bors[bot]
9b000b544b
Merge #11827
11827: internal: Enforce Invariant that Resolver always contains a ModuleScope r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-31 13:01:10 +00:00
Jonas Schievink
ec2d023383 Add "view file text" command to debug sync issues 2022-03-31 14:50:33 +02:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
Manas
1be8b2ff98 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.
2022-03-30 19:07:02 +05:30
Gibson Fahnestock
6b38c2d75e
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.
2022-03-30 12:33:07 +01:00
Florian Diebold
ea1d0bccef Fix divergence detection for bare match arms
Fixes #11814 and #11837.
2022-03-29 21:56:49 +02: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
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
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
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
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
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
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
Jonas Schievink
1e2a4c1bdb Return the first span from Span::join 2022-03-23 15:09:39 +01:00
Jonas Schievink
18ad750786 fix: properly import all types of macros with #[macro_use] again 2022-03-23 14:34:27 +01:00
Waffle Maybe
c8762a17fd
Fix typo in abi_1_57/mod.rs comment 2022-03-23 16:48:25 +04: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
bors[bot]
1a92ee5db5
Merge #11792
11792: minor: Bump dependencies r=Veykril a=Veykril



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-22 21:00:24 +00:00
Kyle Huey
af1aa86ac0 Preserve order when grouping references. 2022-03-22 12:38:59 -07:00
Kyle Huey
0583919919 LSIF: consolidate references into a single edge where possible. 2022-03-22 12:00:52 -07:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Jonas Schievink
4e07864f59 signature help: skip lifetimes when non-lifetime arguments are present 2022-03-22 16:44:27 +01:00