bors
39ebc378c2
Auto merge of #15436 - Veykril:temp-alloc, r=Veykril
...
Preserve `resolve_obligations_as_possible` temporary allocation across calls
This saves ~20ms in the highlihting bench on my machine
```
284ms - highlight
150ms - infer:wait @ per_query_memory_usage
150ms - infer_query
0 - PerNs::filter_visibility (436 calls)
0 - crate_def_map:wait (336 calls)
2ms - deref_by_trait (909 calls)
0 - generic_params_query (1 calls)
0 - inherent_impls_in_block_query (1 calls)
107ms - resolve_obligations_as_possible (17013 calls)
0 - trait_solve::wait (1017 calls)
0 - PerNs::filter_visibility (13 calls)
17ms - Semantics::analyze_impl (19 calls)
0 - SourceBinder::to_module_def (30 calls)
0 - attrs_query (6 calls)
0 - classify_lifetime (1 calls)
0 - classify_lifetime_ref (4 calls)
35ms - classify_name (28 calls)
54ms - classify_name_ref (452 calls)
0 - crate_def_map:wait (375 calls)
7ms - descend_into_macros (776 calls)
0 - generic_params_query (5 calls)
0 - impl_data_with_diagnostics_query (1 calls)
17ms - infer:wait (32 calls)
0 - resolve_obligations_as_possible (1 calls)
0 - source_file_to_def (1 calls)
0 - trait_solve::wait (1 calls)
```
to
```
256ms - highlight
121ms - infer:wait @ per_query_memory_usage
121ms - infer_query
0 - PerNs::filter_visibility (436 calls)
0 - crate_def_map:wait (336 calls)
2ms - deref_by_trait (909 calls)
0 - generic_params_query (1 calls)
0 - inherent_impls_in_block_query (1 calls)
81ms - resolve_obligations_as_possible (17013 calls)
0 - trait_solve::wait (1017 calls)
0 - PerNs::filter_visibility (13 calls)
17ms - Semantics::analyze_impl (19 calls)
0 - SourceBinder::to_module_def (30 calls)
0 - attrs_query (6 calls)
0 - classify_lifetime (1 calls)
0 - classify_lifetime_ref (4 calls)
35ms - classify_name (28 calls)
56ms - classify_name_ref (452 calls)
0 - crate_def_map:wait (375 calls)
7ms - descend_into_macros (776 calls)
0 - generic_params_query (5 calls)
0 - impl_data_with_diagnostics_query (1 calls)
16ms - infer:wait (32 calls)
0 - resolve_obligations_as_possible (1 calls)
0 - source_file_to_def (1 calls)
0 - trait_solve::wait (1 calls)
```
2023-08-12 04:38:32 +00:00
Lukas Wirth
c1c8e787d2
Preserve resolve_obligations_as_possible
temporary allocation across calls
2023-08-12 06:36:31 +02:00
Lukas Wirth
9adff006e8
Simplify
2023-08-10 20:10:19 +02:00
bors
fc2f90e0e5
Auto merge of #15419 - HKalbasi:mir, r=HKalbasi
...
Add mir lower support for tuple destructing assignment
And some other changes in mir eval
2023-08-08 21:02:57 +00:00
hkalbasi
021802c59c
Support enum in memory map patch address
2023-08-09 00:27:23 +03:30
bors
ddbbd6a7e7
Auto merge of #15417 - lowr:patch/purge-generic-arg-data-in-expr, r=HKalbasi
...
internal: use `Cast::cast()` instead of explicit interning
I firmly believe that we should generally use `cast()` instead of interning `GenericArgData` to construct `GenericArg` because it's less verbose and more readable.
2023-08-08 19:27:18 +00:00
oxalica
3bfe1d5d78
Display fully qualified associated types correctly
...
Currently they are formatted in the internal `Trait<Self = Type>::Assoc`
forms where `hir_ty::TypeRef` is formatted, like hover.
2023-08-09 00:04:55 +08:00
Ryo Yoshida
6aa03c5d15
Use Cast::cast()
instead of interning GenericArgData
2023-08-09 00:47:29 +09:00
hkalbasi
31c30933cf
Support closure in clone shim
2023-08-08 01:49:34 +03:30
hkalbasi
b96e4f2f4a
Add mir lower support for tuple destructing assignment
2023-08-07 02:12:35 +03:30
hkalbasi
9b636e2326
Support libc::getenv
in mir interpreter
2023-08-06 01:46:29 +03:30
hkalbasi
3115d6988f
Improve mir interpreter performance by caching
2023-08-04 16:05:54 +03:30
bors
e37ec7262c
Auto merge of #15373 - tadeokondrak:desugar-while-to-loop, r=HKalbasi
...
internal: Desugar while to loop and break
I was reading through rust-analyzer's code and was wondering why this wasn't desugared into a loop.
2023-08-04 07:26:18 +00:00
bors
d398ad3326
Auto merge of #15380 - HKalbasi:mir, r=HKalbasi
...
Fix unsized struct problems in mir eval
2023-08-02 14:28:41 +00:00
hkalbasi
6990d0f26a
Fix unsized struct problems in mir eval
2023-08-02 17:36:11 +03:30
Lukas Wirth
ecb6d07d57
Add currently unused UseId variants
2023-08-02 14:53:45 +02:00
Tadeo Kondrak
92a97c292a
hir: Remove Expr::While
...
The previous commit desugared it to a loop.
2023-08-01 19:08:16 -06:00
Tadeo Kondrak
31bcba84f9
hir: Desugar while
to loop
and break
2023-08-01 19:04:36 -06:00
hkalbasi
a9d81ae89c
Support Self
in mir lowering
2023-07-30 23:05:10 +03:30
bors
f442c4aad6
Auto merge of #15353 - HKalbasi:mir, r=HKalbasi
...
Add manual implementation of clone for tuples in mir interpreter
And some other minor changes.
Clone for tuple is not implemented in the std and it is magically implemented by the compiler, so we need this.
2023-07-28 16:02:13 +00:00
hkalbasi
bd2a8ca507
Add manual implementation of clone for tuples in mir interpreter
2023-07-28 18:52:01 +03:30
Ryo Yoshida
104d707d6a
Add default implementation for HirWrite
methods
2023-07-28 19:11:55 +09:00
Ryo Yoshida
b517aeeca5
Show TyKind::FnDef
as a fn pointer in source code
2023-07-28 19:09:38 +09:00
bors
037844c8a0
Auto merge of #15271 - lowr:patch/re-castable, r=HKalbasi
...
Properly infer types with type casts
This PR reenables `Expectation::Castable` (previous attempt at #14104 , reverted by #14120 ) and implements type cast checks, which enable us to infer a bit more.
Castable expectations are relatively weak -- they only influence the inference if we cannot infer the types by other means. Therefore, we need to defer possible type unification with the casted type until we type check all expressions of the body. This PR adds a struct and slots in `InferenceContext` for the deferred cast checks (c.f. [`CastCheck`] in `rustc_hir_typeck`).
I only implemented the bits that affect the inference result. It should be possible to return type adjustments for well-formed casts and report diagnostics for invalid casts, but I'm leaving them for future work for now.
Fixes #11571
Fixes #15246
[`CastCheck`]: da1d099f91/compiler/rustc_hir_typeck/src/cast.rs (L55)
2023-07-28 07:17:38 +00:00
hkalbasi
17cc813e92
Support atomic fence intrinsic
2023-07-27 12:28:16 +03:30
bors
99718d0c8b
Auto merge of #15303 - oxalica:fix/byte-escape-highlight, r=lowr
...
Fix highlighting of byte escape sequences
Currently non-UTF8 escape sequences in byte strings and any escape sequences in byte literals are ignored.
2023-07-22 20:25:40 +00:00
bors
a317fa865c
Auto merge of #15325 - HKalbasi:mir, r=flodiebold
...
Normalize expected ty in call arguments
fix #15321
I'm not sure if we should do this, or add a normalize in the beginning of `infer_expr_inner`, or somewhere else. r? `@lowr`
2023-07-22 08:14:06 +00:00
hkalbasi
b7d91ca5b2
Normalize expected ty in call arguments
2023-07-22 01:06:58 +03:30
bors
59d35d24a7
Auto merge of #15320 - lowr:fix/incorrect-name-case-for-inner-items, r=HKalbasi
...
Report `incorrect-ident-case` for inner items
Fixes #15319
Although we have been collecting the diagnostics for inner items within function bodies, we were discarding them and never reported to the users. This PR makes sure that they are all reported and additionally collects the diagnostics for inner items within const bodies, static bodies, and enum variant bodies.
2023-07-21 06:41:30 +00:00
Ryo Yoshida
33b7b45f67
Report incorrect case for inner items within all bodies
2023-07-21 15:07:55 +09:00
Ryo Yoshida
b53a07835b
Report incorrect case for fn inner items
2023-07-21 15:07:49 +09:00
bors
be82869dd5
Auto merge of #15317 - HKalbasi:mir, r=HKalbasi
...
Lookup super traits in `is_dyn_method`
2023-07-20 12:30:45 +00:00
hkalbasi
ed8e1fd472
Lookup super traits in is_dyn_method
2023-07-20 15:43:42 +03:30
bors
6b8eb75e12
Auto merge of #15316 - HKalbasi:mir, r=HKalbasi
...
Pass `TraitEnvironment` into `layout_ty` and `const_eval`
We need to do either this or get rid of trait environment in `normalize_ty`. Let's go with this for now.
2023-07-20 09:39:06 +00:00
hkalbasi
eb143383c3
Pass TraitEnvironment
into layout_ty
and const_eval
2023-07-20 13:08:38 +03:30
Alex Kirszenberg
5187533495
Don't follow raw pointer derefs for method receiver type candidates
2023-07-19 19:48:56 +02:00
oxalica
59a3e42ac9
Fix unescaping of C string literals
2023-07-18 18:52:34 +08:00
hkalbasi
e64a10fc4d
Use .kind(Interner)
instead of .data(Interner).kind
2023-07-17 20:56:31 +03:30
hkalbasi
832eb0d94c
Normalize type alias in projected_ty
2023-07-17 01:16:26 +03:30
hkalbasi
41b8b0b77d
Enable cfg miri in analysis
2023-07-14 22:59:46 +03:30
bors
8e5f944317
Auto merge of #15282 - HKalbasi:mir, r=HKalbasi
...
Give real discriminant_type to chalk
2023-07-14 16:46:35 +00:00
hkalbasi
50559118fb
Give real discriminant_type to chalk
2023-07-14 20:15:18 +03:30
hkalbasi
5208bf8f55
implement type_name intrinsic
2023-07-14 16:52:36 +03:30
bors
f6ae0c11ac
Auto merge of #15270 - ChristianSchott:patch-1, r=HKalbasi
...
Make fields of mir::Terminator public
When trying to use the RA crate, I am unable to access the fields in `hir_def::mir::Terminator`.
I don't see any reason, why these should be private, especially as the fields of `hir_def::mir::Statement` are `pub`.
I am not sure if the fields in `hir_def::mir::SwitchTargets` should be made `pub` too, but at least they are read-accessible via some public methods..
Sorry if I missed something, this is my first PR.
2023-07-13 07:54:44 +00:00
bors
d16d5fcf68
Auto merge of #15268 - HKalbasi:mir, r=HKalbasi
...
Add write_bytes and ctlz intrinsics
2023-07-12 23:19:30 +00:00
Ryo Yoshida
074488b290
Properly infer types with type casts
2023-07-13 00:14:15 +09:00
ChristianSchott
8f612b5352
Make fields of mir::Terminator public
2023-07-12 09:35:44 +02:00
hkalbasi
274e8301c1
Add write_bytes and ctlz intrinsics
2023-07-12 01:14:49 +03:30
Ryo Yoshida
0312c6c321
Mark test for MIR execution limit as slow test
2023-07-11 23:36:47 +09:00
hkalbasi
59420afa46
Support getrandom syscall
2023-07-11 00:29:06 +03:30