rust/compiler
bors a20a04e5d6 Auto merge of #113108 - compiler-errors:normalize-opaques-with-late-bound-vars-again, r=jackh726
Normalize opaques with late-bound vars again

We have a hack in the compiler where if an opaque has escaping late-bound vars, we skip revealing it even though we *could* reveal it from a technical perspective. First of all, this is weird, since we really should be revealing all opaques in `Reveal::All` mode. Second of all, it causes subtle bugs (linked below).

I attempted to fix this in #100980, which was unfortunately reverted due to perf regressions on codebases that used really deeply nested futures in some interesting ways. The worst of which was #103423, which caused the project to hang on build. Another one was #104842, which was just a slow-down, but not a hang. I took some time afterwards to investigate how to rework `normalize_erasing_regions` to take advantage of better caching, but that effort kinda fizzled out (#104133).

However, recently, I was made aware of more bugs whose root cause is not revealing opaques during codegen. That made me want to fix this again -- in the process, interestingly, I took the the minimized example from https://github.com/rust-lang/rust/issues/103423#issuecomment-1292947043, and it doesn't seem to hang any more...

Thinking about this harder, there have been some changes to the way we lower and typecheck async futures that may have reduced the pathologically large number of outlives obligations (see description of #103423) that we were encountering when normalizing opaques with bound vars the last time around:
* #104321 (lower `async { .. }` directly as a generator that implements `Future`, removing the `from_generator` shim)
* #104833 (removing an `identity_future` fn that was wrapping desugared future generators)

... so given that I can see:
* No significant regression on rust perf bot (https://github.com/rust-lang/rust/pull/107620#issuecomment-1600070317)
* No timeouts in crater run I did (https://github.com/rust-lang/rust/pull/107620#issuecomment-1605428952, rechecked failing crates in https://github.com/rust-lang/rust/pull/107620#issuecomment-1605973434)

... and given that this PR:
* Fixes #104601
* Fixes #107557
* Fixes #109464
* Allows us to remove a `DefiningAnchor::Bubble` from codegen (75a8f68183)

I'm inclined to give this another shot at landing this. Best case, it just works -- worst case, we get more examples to study how we need to improve the compiler to make this work.

r? types
2023-06-29 15:37:11 +00:00
..
rustc fix link 2023-03-11 10:53:47 -06:00
rustc_abi Auto merge of #112062 - lukas-code:unsized-layout, r=wesleywiser 2023-06-13 22:34:59 +00:00
rustc_apfloat
rustc_arena Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
rustc_ast Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
rustc_ast_lowering hir: Add Become expression kind 2023-06-26 08:56:32 +00:00
rustc_ast_passes Auto merge of #113105 - matthiaskrgr:rollup-rci0uym, r=matthiaskrgr 2023-06-27 21:31:47 +00:00
rustc_ast_pretty Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
rustc_attr Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_baked_icu_data Regen baked data 2023-05-02 10:45:16 -07:00
rustc_borrowck don't suggest move for borrows that aren't closures 2023-06-28 23:56:58 +02:00
rustc_builtin_macros Auto merge of #112802 - lukas-code:fancy-bool, r=Nilstrieb 2023-06-24 11:43:41 +00:00
rustc_codegen_cranelift Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
rustc_codegen_gcc Auto merge of #112814 - antoyo:sync-cg_gcc-2023-06-19, r=bjorn3 2023-06-22 02:11:08 +00:00
rustc_codegen_llvm Auto merge of #112516 - erikdesjardins:loop, r=davidtwco 2023-06-27 15:01:56 +00:00
rustc_codegen_ssa Rollup merge of #112946 - nnethercote:improve-cgu-naming-and-ordering, r=wesleywiser 2023-06-29 03:29:32 +09:00
rustc_const_eval remove FIXME and add test 2023-06-28 07:59:36 -04:00
rustc_data_structures Rollup merge of #112538 - ndrewxie:issue-84447-partial-1, r=compiler-errors 2023-06-21 20:00:49 +02:00
rustc_driver fix spelling error 2023-06-05 16:01:09 +02:00
rustc_driver_impl Provide more context for rustc +nightly -Zunstable-options on stable 2023-06-27 23:23:33 +08:00
rustc_error_codes Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
rustc_error_messages Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
rustc_errors s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
rustc_expand Rollup merge of #111571 - jhpratt:proc-macro-span, r=m-ou-se 2023-06-28 18:28:46 +05:30
rustc_feature Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_fluent_macro Fix diagnostics with errors 2023-05-26 10:44:18 +00:00
rustc_fs_util Add try_canonicalize to rustc_fs_util and use it over fs::canonicalize 2023-03-16 21:50:23 +01:00
rustc_graphviz enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
rustc_hir Auto merge of #112887 - WaffleLapkin:become_unuwuable_in_hir, r=compiler-errors,Nilstrieb 2023-06-26 13:51:04 +00:00
rustc_hir_analysis Auto merge of #112629 - compiler-errors:atb-imply, r=jackh726 2023-06-28 23:58:28 +00:00
rustc_hir_pretty hir: Add Become expression kind 2023-06-26 08:56:32 +00:00
rustc_hir_typeck Rollup merge of #113084 - WaffleLapkin:less_map_or, r=Nilstrieb 2023-06-27 22:10:15 +02:00
rustc_incremental Applied nits 2023-06-11 22:45:04 -04:00
rustc_index Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_infer avoid using format!("{}", ..) 2023-06-27 22:12:29 +09:00
rustc_interface Auto merge of #112708 - flip1995:clippy-freezing-pc-with-ice, r=oli-obk 2023-06-28 09:40:07 +00:00
rustc_lexer Don't try to eat non-existent decimal digits. 2023-05-15 18:33:12 +10:00
rustc_lint Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_lint_defs Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_llvm Add SafeStack support to rustc 2023-05-26 15:18:54 -04:00
rustc_log Stabilize IsTerminal 2023-04-10 17:24:23 +09:00
rustc_macros Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwco 2023-06-28 03:47:02 +00:00
rustc_metadata Auto merge of #98867 - cjgillot:metaloop, r=oli-obk 2023-06-28 16:16:27 +00:00
rustc_middle Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_mir_build remove cruft 2023-06-28 01:55:32 -04:00
rustc_mir_dataflow Export AnalysisResults trait in rustc_mir_dataflow 2023-06-27 11:35:32 +02:00
rustc_mir_transform Auto merge of #112307 - lcnr:operand-ref, r=compiler-errors 2023-06-28 00:41:37 +00:00
rustc_monomorphize Tweak thread names for CGU processing. 2023-06-26 09:14:45 +10:00
rustc_parse Auto merge of #113105 - matthiaskrgr:rollup-rci0uym, r=matthiaskrgr 2023-06-27 21:31:47 +00:00
rustc_parse_format Fix typos in compiler 2023-04-10 22:02:52 +02:00
rustc_passes Auto merge of #111269 - clubby789:validate-fluent-variables, r=davidtwco 2023-06-28 03:47:02 +00:00
rustc_plugin_impl Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
rustc_privacy Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_query_impl Avoid calling queries during query stack printing 2023-06-27 16:12:07 +02:00
rustc_query_system Rollup merge of #112333 - Zoxc:try_collect_active_jobs-deadlock, r=cjgillot 2023-06-08 12:36:18 +02:00
rustc_resolve Rollup merge of #113084 - WaffleLapkin:less_map_or, r=Nilstrieb 2023-06-27 22:10:15 +02:00
rustc_serialize Fix the FileEncoder buffer size. 2023-05-15 08:59:11 +10:00
rustc_session Rollup merge of #113084 - WaffleLapkin:less_map_or, r=Nilstrieb 2023-06-27 22:10:15 +02:00
rustc_smir Rollup merge of #112232 - fee1-dead-contrib:match-eq-const-msg, r=b-naber 2023-06-19 17:53:33 -07:00
rustc_span Rollup merge of #112670 - petrochenkov:typriv, r=eholk 2023-06-29 05:48:39 +02:00
rustc_symbol_mangling Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_target Rollup merge of #111326 - he32:netbsd-aarch64-be, r=oli-obk 2023-06-26 11:58:43 +02:00
rustc_trait_selection Auto merge of #113108 - compiler-errors:normalize-opaques-with-late-bound-vars-again, r=jackh726 2023-06-29 15:37:11 +00:00
rustc_traits Remove unnecessary DefineOpaqueTypes::Bubble from codegen 2023-06-27 21:36:15 +00:00
rustc_transmute Safe Transmute: Refactor error handling and Answer type 2023-06-12 16:56:21 -07:00
rustc_ty_utils Rollup merge of #112867 - compiler-errors:more-impl-source-nits, r=lcnr 2023-06-28 18:28:47 +05:30
rustc_type_ir Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00