rust/compiler
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
..
rustc remove unused jemallocator crate 2022-01-28 16:56:05 +01:00
rustc_apfloat Stabilize iter::zip. 2021-12-14 18:50:31 -04:00
rustc_arena Remove unused dep from rustc_arena 2022-02-02 17:37:14 +01:00
rustc_ast Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_ast_lowering More let_else adoptions 2022-02-02 17:11:01 +01:00
rustc_ast_passes add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_ast_pretty Change struct expr pretty printing to match rustfmt style 2022-02-03 10:59:35 -08:00
rustc_attr More let_else adoptions 2022-02-02 17:11:01 +01:00
rustc_borrowck Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_builtin_macros Rollup merge of #93416 - name1e5s:chore/remove_allow_fail, r=m-ou-se 2022-02-07 14:08:34 +00:00
rustc_codegen_cranelift Use an indexmap to avoid sorting LocalDefIds 2022-01-22 22:34:16 -06:00
rustc_codegen_gcc Merge landing_pad and set_cleanup into cleanup_landing_pad 2022-01-24 14:10:05 +01:00
rustc_codegen_llvm Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser 2022-02-04 18:42:13 +01:00
rustc_codegen_ssa Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser 2022-02-04 18:42:13 +01:00
rustc_const_eval Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_data_structures Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_driver Rollup merge of #93566 - Aaron1011:rustc-backtrace, r=davidtwco 2022-02-03 22:20:26 +09:00
rustc_error_codes Rollup merge of #91939 - GKFX:feature-91866, r=cjgillot 2022-02-06 04:13:29 +01:00
rustc_errors add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_expand add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_feature Rollup merge of #93682 - PatchMixolydic:where-in-the-world-is-const_fn_trait_bound, r=oli-obk 2022-02-07 14:08:37 +00:00
rustc_fs_util
rustc_graphviz eplace usages of vec![].into_iter with [].into_iter 2022-01-09 14:09:25 +11:00
rustc_hir Auto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obk 2022-02-07 00:26:52 +00:00
rustc_hir_pretty Change pp indent to signed to allow negative indents 2022-02-03 10:59:09 -08:00
rustc_incremental add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_index implement lint for suspicious auto trait impls 2022-02-01 09:55:19 +01:00
rustc_infer Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_interface Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser 2022-02-04 18:42:13 +01:00
rustc_lexer
rustc_lint Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_lint_defs implement lint for suspicious auto trait impls 2022-02-01 09:55:19 +01:00
rustc_llvm Windows: Disable LLVM crash dialog boxes. 2022-01-27 16:53:17 -08:00
rustc_log Make rustc_log doc test runnable 2022-01-03 22:31:56 -08:00
rustc_macros Make Decodable and Decoder infallible. 2022-01-22 10:38:31 +11:00
rustc_metadata Auto merge of #93539 - petrochenkov:doclink, r=camelid,michaelwoerister 2022-02-05 18:27:06 +00:00
rustc_middle Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_mir_build Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_mir_dataflow rustc_mir_dataflow: use iter::once instead of Some().into_iter 2022-02-03 13:52:26 -07:00
rustc_mir_transform Rollup merge of #90132 - joshtriplett:stabilize-instrument-coverage, r=wesleywiser 2022-02-04 18:42:13 +01:00
rustc_monomorphize add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_parse clippy::perf fixes 2022-02-03 21:45:51 +01:00
rustc_parse_format
rustc_passes Rollup merge of #90998 - jhpratt:require-const-stability, r=oli-obk 2022-02-06 10:43:50 +01:00
rustc_plugin_impl
rustc_privacy add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_query_impl add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_query_system Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00
rustc_resolve resolve lifetimes for const generic defaults 2022-02-05 01:30:14 -08:00
rustc_save_analysis More let_else adoptions 2022-02-02 17:11:01 +01:00
rustc_serialize Drop json::from_reader 2022-02-05 15:07:10 -05:00
rustc_session Rollup merge of #93608 - nnethercote:speed-up-find_library_crate, r=petrochenkov 2022-02-04 18:42:16 +01:00
rustc_span Auto merge of #93179 - Urgau:unreachable-2021, r=m-ou-se,oli-obk 2022-02-07 00:26:52 +00:00
rustc_symbol_mangling add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
rustc_target Rollup merge of #93680 - Mark-Simulacrum:drop-json-reader, r=bjorn3 2022-02-07 14:08:36 +00:00
rustc_trait_selection Fix some doctests where the main function returns an opaque type 2022-02-02 17:15:18 +00:00
rustc_traits Lazily resolve type-alias-impl-trait defining uses 2022-02-02 15:40:11 +00:00
rustc_ty_utils remove TyS::same_type 2022-02-01 11:21:26 +01:00
rustc_type_ir Remove some unused arguments and update a comment 2022-02-02 15:40:12 +00:00
rustc_typeck Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis 2022-02-07 23:40:26 +00:00