rust/crates
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
..
base-db implement type_name intrinsic 2023-07-14 16:52:36 +03:30
cfg Replace x with it 2023-07-06 17:33:17 +03:30
flycheck Bump more deps 2023-06-22 11:44:10 +02:00
hir Auto merge of #15320 - lowr:fix/incorrect-name-case-for-inner-items, r=HKalbasi 2023-07-21 06:41:30 +00:00
hir-def Fix unescaping of C string literals 2023-07-18 18:52:34 +08:00
hir-expand Auto merge of #15282 - HKalbasi:mir, r=HKalbasi 2023-07-14 16:46:35 +00:00
hir-ty Auto merge of #15271 - lowr:patch/re-castable, r=HKalbasi 2023-07-28 07:17:38 +00:00
ide Add comments for why skip highlighting for invalid char/byte literals 2023-07-23 04:24:35 +08:00
ide-assists limit change_visibility assist to applicable items 2023-07-22 17:16:51 +03:00
ide-completion Replace x with it 2023-07-06 17:33:17 +03:30
ide-db Fix the eager token maps by re-mapping the textranges between the input and input expansion 2023-07-13 09:22:38 +02:00
ide-diagnostics Report incorrect case for inner items within all bodies 2023-07-21 15:07:55 +09:00
ide-ssr Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
intern Bump more deps 2023-06-22 11:44:10 +02:00
limit Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
load-cargo Fix publishing of load-cargo crate 2023-07-10 13:40:37 +03:00
mbe Fix the eager token maps by re-mapping the textranges between the input and input expansion 2023-07-13 09:22:38 +02:00
parser Remove crate visibility modifier 2023-07-16 00:01:11 +09:00
paths internal: use consistent style for error handling 2023-06-19 13:01:47 +01:00
proc-macro-api Support reading uncompressed proc macro metadata 2023-07-17 13:30:19 +00:00
proc-macro-srv Merge remote-tracking branch 'upstream/master' into sync-from-rust 2023-07-17 16:09:39 +03:00
proc-macro-srv-cli Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
proc-macro-test ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
profile Use anonymous lifetime where possible 2023-06-29 23:27:28 +09:00
project-model Optimize DepKindInfo -> DepKind conversion 2023-07-21 17:10:42 +09:00
rust-analyzer Auto merge of #15303 - oxalica:fix/byte-escape-highlight, r=lowr 2023-07-22 20:25:40 +00:00
sourcegen Format let-else 2023-07-03 20:34:09 +02:00
stdx Bump more deps 2023-06-22 11:44:10 +02:00
syntax Fix unescaping of C string literals 2023-07-18 18:52:34 +08:00
test-utils Give real discriminant_type to chalk 2023-07-14 20:15:18 +03:30
text-edit Merge commit 'aa9bc86125' into sync-from-ra 2023-06-05 12:04:23 +03:00
toolchain ⬆️ rust-analyzer 2023-03-13 10:42:24 +02:00
tt Fix the eager token maps by re-mapping the textranges between the input and input expansion 2023-07-13 09:22:38 +02:00
vfs Upgrade to indexmap v2 2023-06-24 17:35:20 -07:00
vfs-notify Downgrade some deps to get rif of windows-sys duplication 2023-06-22 11:44:10 +02:00