rust/compiler/rustc_borrowck/src
bors e7cc3bddbe Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis
Lazy type-alias-impl-trait

Previously opaque types were processed by

1. replacing all mentions of them with inference variables
2. memorizing these inference variables in a side-table
3. at the end of typeck, resolve the inference variables in the side table and use the resolved type as the hidden type of the opaque type

This worked okayish for `impl Trait` in return position, but required lots of roundabout type inference hacks and processing.

This PR instead stops this process of replacing opaque types with inference variables, and just keeps the opaque types around.
Whenever an opaque type `O` is compared with another type `T`, we make the comparison succeed and record `T` as the hidden type. If `O` is compared to `U` while there is a recorded hidden type for it, we grab the recorded type (`T`) and compare that against `U`. This makes implementing

* https://github.com/rust-lang/rfcs/pull/2515

much simpler (previous attempts on the inference based scheme were very prone to ICEs and general misbehaviour that was not explainable except by random implementation defined oddities).

r? `@nikomatsakis`

fixes #93411
fixes #88236
2022-02-07 23:40:26 +00:00
..
constraints Remove ordering traits from rustc_borrowck::constraints::OutlivesConstraint 2022-01-19 13:12:26 -06:00
diagnostics Rollup merge of #93590 - est31:let_else, r=lcnr 2022-02-02 19:34:07 +01:00
region_infer Avoid an ICE in the presence of HKL 2022-02-02 15:40:12 +00:00
type_check Fixup changes that aren't neccessary anymore 2022-02-02 15:40:11 +00:00
borrow_set.rs Remove in_band_lifetimes from borrowck 2021-12-15 08:39:21 +01:00
borrowck_errors.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
constraint_generation.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
consumers.rs Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts 2021-10-06 19:07:56 -07:00
dataflow.rs Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
def_use.rs Remove deprecated LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
facts.rs Move the dataflow framework to its own crate. 2021-09-07 19:57:07 +02:00
invalidation.rs Remove no longer used MutateMode enum 2022-01-12 18:51:31 +01:00
lib.rs Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
location.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
member_constraints.rs Remove in_band_lifetimes from borrowck 2021-12-15 08:39:21 +01:00
nll.rs Rename functions reflect that inline const is also "typeck_child" 2021-11-07 04:00:34 +00:00
path_utils.rs Remove in_band_lifetimes from borrowck 2021-12-15 08:39:21 +01:00
place_ext.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
places_conflict.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
prefixes.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00
renumber.rs Visit type in process_projection_elem. 2021-11-27 17:39:27 +01:00
universal_regions.rs Lazily resolve type-alias-impl-trait defining uses 2022-02-02 15:40:11 +00:00
used_muts.rs Move rustc_mir::borrow_check to new crate rustc_borrowck. 2021-09-07 00:29:22 +02:00