rust/src
bors e52e7115c7 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`
2022-05-21 23:34:30 +00:00
..
bootstrap Bump LLVM fetched from CI to fix run-make 2022-05-20 18:56:21 -04:00
ci Rollup merge of #97139 - GuillaumeGomez:move-dom-settings-generation, r=notriddle 2022-05-19 08:22:44 +09:00
doc Rollup merge of #97203 - ehuss:rustc-summary-formatting, r=Dylan-DPC 2022-05-20 19:54:42 +02:00
etc Read the Ref/RefMut pointer in natvis 2022-05-16 17:39:34 -07:00
librustdoc Auto merge of #97246 - GuillaumeGomez:rollup-btcok8x, r=GuillaumeGomez 2022-05-21 11:28:48 +00:00
llvm-project@4784866596 Update LLVM submodule 2022-05-12 10:17:27 +02:00
rustdoc-json-types rustdoc-json: Fix HRTBs for WherePredicate::BoundPredicate 2022-05-04 21:03:01 +02:00
test Auto merge of #96515 - lcnr:user-types-in-pat, r=nikomatsakis 2022-05-21 23:34:30 +00:00
tools Auto merge of #97248 - xFrednet:clippyup, r=Manishearth 2022-05-21 17:25:49 +00:00
README.md
stage0.json Bump stage 0 to new beta 2022-05-18 11:38:34 -04:00
version Bump to 1.63 2022-05-13 10:08:03 -04:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.