about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-05-21 23:34:30 +0000
committerbors <bors@rust-lang.org>2022-05-21 23:34:30 +0000
commite52e7115c7477bbc257c44447bb7eccbcfe9cfb2 (patch)
tree57710ee1dafdbaff8d7ecb7631c77d2e0b99a4a3 /compiler/rustc_codegen_gcc/src
parent9257f5aad02b65665a6e23e5b92938548302e129 (diff)
parent76370084fae1c1dad0af1058c666471e0766c56f (diff)
downloadrust-e52e7115c7477bbc257c44447bb7eccbcfe9cfb2.tar.gz
rust-e52e7115c7477bbc257c44447bb7eccbcfe9cfb2.zip
Auto merge of #96515 - lcnr:user-types-in-pat, r=nikomatsakis
correctly deal with user type ascriptions in pat

supersedes #93856

`thir::PatKind::AscribeUserType` previously resulted in `CanonicalUserTypeAnnotations` where the inferred type already had a subtyping relation according to `variance` to the `user_ty`.

The bug can pretty much be summarized as follows:

- during mir building
  - `user_ty -> inferred_ty`: considers variance
  - `StatementKind::AscribeUserType`: `inferred_ty` is the type of the place, so no variance needed
- during mir borrowck
  - `user_ty -> inferred_ty`: does not consider variance
  - `StatementKind::AscribeUserType`: applies variance

This mostly worked fine. The lifetimes in `inferred_ty` were only bound by its relation to `user_ty` and to the `place` of `StatementKind::AscribeUserType`, so it doesn't matter where exactly the subtyping happens.

It does however matter when having higher ranked subtying. At this point the place where the subtyping happens is forced, causing this mismatch between building and borrowck to result in unintended errors.

cc #96514 which is pretty much the same issue

r? `@nikomatsakis`
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
0 files changed, 0 insertions, 0 deletions