Lukas Wirth
d6fc4a9ea6
Simplify breakables handling
2022-09-01 14:41:37 +02:00
Lukas Wirth
ee02a4721b
Remove unnecessary allocations
2022-08-31 18:05:52 +02:00
Lukas Wirth
192a79c235
Remove hir::Expr::MacroStmts
...
This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.
2022-08-31 16:58:11 +02:00
bors
56d888689b
Auto merge of #12793 - lowr:fix/12739, r=Veykril
...
fix: sort and deduplicate auto traits in trait object types
Fixes #12739
Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like [`rustc`](880416180b/compiler/rustc_typeck/src/astconv/mod.rs (L1487-L1488)
) and [`chalk-integration`](https://github.com/rust-lang/chalk/blob/master/chalk-integration/src/lowering.rs#L575 ) do.
Quoting from [the Chalk book](https://rust-lang.github.io/chalk/book/types/rust_types.html#dyn-types ):
> Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a `dyn Foo + Send` and a `dyn Send + Foo`, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.
Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.
2022-08-31 08:28:12 +00:00
Lukas Wirth
5c0e25237c
Drop the expander borrow in all control flow paths
...
The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.
2022-08-31 10:04:01 +02:00
Ryo Yoshida
7ecead23c8
fix: sort and deduplicate auto traits in trait object types
2022-08-30 20:52:42 +09:00
Lukas Wirth
78a7a816bf
minor: Simplify
2022-08-26 19:40:01 +02:00
Lukas Wirth
d025c5d8d6
Make use of NoHash hashing for FileId and CrateId
2022-08-25 20:41:49 +02:00
bors
fdc28b4333
Auto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold
...
fix: Fix panics on GATs involving const generics
This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.
The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.
Fixes #11989 , fixes #12193
2022-08-22 14:00:23 +00:00
Dominik Gschwind
ac8cb8ce3b
Expect the test to panic by catching the unwind
2022-08-21 22:48:53 +02:00
Ryo Yoshida
dd22aa48ba
Consider bounds on inherent impl in method resolution
2022-08-21 18:41:46 +09:00
Laurențiu Nicola
c3bb7bfc28
Bump chalk
2022-08-19 21:33:28 +03:00
bors
0a33d04a3d
Auto merge of #13053 - lowr:fix/pat-sole-Self, r=Veykril
...
fix: resolve path `Self` alone in value namespace
Fixes #12968
2022-08-18 11:17:40 +00:00
Ryo Yoshida
dac27679f7
fix: resolve path Self
alone in value namespace
2022-08-18 20:12:59 +09:00
bors
1da9156b0d
Auto merge of #12982 - jridgewell:into_future, r=Veykril
...
Implement IntoFuture type inference
One of my projects is using [IntoFuture](https://doc.rust-lang.org/std/future/trait.IntoFuture.html ) to make our async code a little less verbose. However, rust-analyzer can't infer the output type of an await expression if the value uses `IntoFuture` to convert into another type. So we're getting `{unknown}` types everywhere since switching.
`foo.await` itself [desugars](e4417cf020/compiler/rustc_ast_lowering/src/expr.rs (L644-L658)
) into a `match into_future(foo) {}`, with every `Future` impl getting a [default](e4417cf020/library/core/src/future/into_future.rs (L131-L139)
) `IntoFuture` implementation. I'm not sure if we want to disable the old `future_trait` paths, since this only recently [stabilize](https://github.com/rust-lang/rust/pull/98718 ).
2022-08-18 07:37:47 +00:00
Ryo Yoshida
12abaf8ddd
fix: resolve associated types of bare dyn types
2022-08-18 07:05:41 +09:00
Dominik Gschwind
ad7a1ed8cc
fix: Fix panics on GATs involving const generics
...
This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.
The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.
2022-08-16 17:30:17 +02:00
Jonas Schievink
8c60813096
Fix lowering of empty macro expressions in trailing position
2022-08-15 18:01:58 +02:00
Ryo Yoshida
ffc6b42901
fix: infer byte string pattern as &[u8]
when matched against slices
2022-08-10 19:17:13 +09:00
Justin Ridgewell
5810c8188a
Implement IntoFuture type inference
2022-08-08 21:05:56 -04:00
KaDiWa
232176b46a
remove imports that are also in edition 2021's prelude
2022-08-09 01:16:32 +02:00
oxalica
326ffee5b7
Returns the old value for la_arena::ArenaMap::insert
2022-08-07 04:53:23 +08:00
Lukas Wirth
d6e78b04d0
feat: Handle operators like their trait functions in the IDE
2022-08-05 14:16:36 +02:00
Lukas Wirth
1f8daa180f
fix: Honor ref expressions for compute_ref_match completions
2022-07-27 13:48:26 +02:00
Ryo Yoshida
805ac666ca
fix: consider assignee expressions in record fields exhaustiveness check
2022-07-24 22:40:04 +09:00
Ryo Yoshida
64758bd481
Add info whether it's assignee expr to relevant HIR Expr
variants
2022-07-24 22:40:00 +09:00
Ryo Yoshida
fb063d360c
Add ellipsis
to HIR RecordLit
2022-07-24 17:10:31 +09:00
bors
84a6fac37a
Auto merge of #12841 - Veykril:query-fix, r=Veykril
...
fix: Fix `trait_impls_in_deps_query` being called directly instead of as a query
Fixes the inlay hint performance regression introdcuced by https://github.com/rust-analyzer/rust-analyzer/issues/12549
2022-07-21 08:23:19 +00:00
Lukas Wirth
cfad882745
fix: Fix trait_impls_in_deps_query
being called directly instead of as a query
2022-07-21 10:23:07 +02:00
Amos Wenger
ade31ad757
Rename proc macro server from 'Rustc' to 'RustAnalyzer'
2022-07-20 15:40:23 +02:00
Amos Wenger
7e285e1ef5
Run cargo fmt
2022-07-20 15:06:15 +02:00
Amos Wenger
816f7fe12a
Run cargo fix --edition-idioms
2022-07-20 15:02:08 +02:00
Amos Wenger
23d25a3094
Enable extra warnings required by rust-lang/rust
2022-07-20 15:00:17 +02:00
Amos Wenger
1b416473a3
Upgrade to expect-test@1.4.0
...
cf. https://github.com/rust-analyzer/expect-test/issues/33
cf. https://github.com/rust-lang/rust/pull/99444#issuecomment-1188844202
2022-07-19 13:00:45 +02:00
bors
22e53f1d33
Auto merge of #12549 - bitgaoshu:goto_where_trait_m_impl, r=Veykril
...
feat: Go to implementation of trait methods
try goto where the trait method implies, #4558
2022-07-18 16:29:23 +00:00
bors
db6a85d358
Auto merge of #12778 - Logarithmus:feature/fix-negative-const-generics, r=flodiebold
...
Support negative, `char` & `bool` const generics
Before:
![Before](https://user-images.githubusercontent.com/29541480/179379832-0c3b2a74-fef6-427e-b89f-7e31d9c37b3d.png )
After:
![After](https://user-images.githubusercontent.com/29541480/179379863-b62475dd-e7bf-41f2-b437-08dfe55951af.png )
I tried to implement stuff like `Const<{NUM1 + 3 + NUM2}>` by using already existing constant evaluation mechanism for ordinary constants, but turned out to be harder than I thought, maybe because I've never ever tinkered with compilers before
2022-07-17 17:17:39 +00:00
Artur Sinila
83177a7cfe
fix: address suggestions
2022-07-17 18:22:11 +03:00
iDawer
a0fd58bbbe
Check for local IDs belong to same definition
2022-07-17 11:43:08 +05:00
Artur Sinila
a96f0aa7cd
feat: support negative const generic parameters
...
* feat: support `bool` & `char` const generics
2022-07-17 04:18:53 +03:00
Jonas Schievink
6c6ae965ba
Update remaining GitHub URLs
2022-07-08 15:44:49 +02:00
Laurențiu Nicola
78beb4c444
Bump chalk
2022-07-03 10:22:10 +03:00
Laurențiu Nicola
5381811368
Bump tracing-subscriber
2022-07-03 10:12:58 +03:00
Laurențiu Nicola
791f2a0bec
Bump smallvec
2022-07-03 10:09:35 +03:00
Ryo Yoshida
649e1f54cf
fix: report type mismatch on identifier in destructuring assignments
2022-07-03 03:29:15 +09:00
Ryo Yoshida
afdbd6cce2
fix: infer lhs first on ordinary assignment expressions
2022-07-03 03:29:02 +09:00
a-kenji
f2963cf8ff
fix: typos in hir-ty
2022-07-02 17:19:06 +02:00
Florian Diebold
e71519572c
Add tests for #12669
2022-07-01 19:00:07 +02:00
Lukas Wirth
e5e5a0932d
Fix blocks not considering stmt without semi as tails
2022-07-01 16:25:52 +02:00
Lukas Wirth
58d5c69a63
Fix Expr::MacroStmts using wrong scopes
2022-07-01 15:34:29 +02:00
Lukas Wirth
9165e3b381
Update hir-ty test outputs
2022-07-01 15:21:55 +02:00