rust/compiler
bors d9a2cc4dae Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot
Stop storing a special inner body for the coroutine by-move body for async closures

...and instead, just synthesize an item which is treated mostly normally by the MIR pipeline.

This PR does a few things:
* We synthesize a new `DefId` for the by-move body of a closure, which has its `mir_built` fed with the output of the `ByMoveBody` MIR transformation, and some other relevant queries.
* This has the `DefKind::ByMoveBody`, which we use to distinguish it from "real" bodies (that come from HIR) which need to be borrowck'd. Introduce `TyCtxt::is_synthetic_mir` to skip over `mir_borrowck` which is called by `mir_promoted`; borrowck isn't really possible to make work ATM since it heavily relies being called on a body generated from HIR, and is redundant by the construction of the by-move-body.
* Remove the special `PassManager` hacks for handling the inner `by_move_body` stored within the coroutine's mir body. Instead, this body is fed like a regular MIR body, so it's goes through all of the `tcx.*_mir` stages normally (build -> promoted -> ...etc... -> optimized) .
* Remove the `InstanceKind::ByMoveBody` shim, since now we have a "regular" def id, we can just use `InstanceKind::Item`. This also allows us to remove the corresponding hacks from codegen, such as in `fn_sig_for_fn_abi` .

Notable remarks:
* ~~I know it's kind of weird to be using `DefKind::Closure` here, since it's not a distinct closure but just a new MIR body. I don't believe it really matters, but I could also use a different `DefKind`... maybe one that we could use for synthetic MIR bodies in general?~~ edit: We're doing this now.
2024-08-27 23:30:24 +00:00
..
rustc Link std statically in rustc_driver 2024-08-11 04:16:53 +02:00
rustc_abi ABI compat check: detect unadjusted ABI mismatches 2024-08-27 09:04:59 +02:00
rustc_arena Add warn(unreachable_pub) to rustc_arena. 2024-08-16 08:46:22 +10:00
rustc_ast Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
rustc_ast_ir Add warn(unreachable_pub) to several crates. 2024-08-16 08:46:13 +10:00
rustc_ast_lowering Rollup merge of #129626 - compiler-errors:explicit-named, r=fmease 2024-08-27 00:42:02 +02:00
rustc_ast_passes Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
rustc_ast_pretty Add warn(unreachable_pub) to rustc_ast_pretty. 2024-08-16 08:46:46 +10:00
rustc_attr Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
rustc_baked_icu_data Don't add warn(unreachable_pub) to rustc_baked_icu. 2024-08-16 08:46:52 +10:00
rustc_borrowck Rollup merge of #129340 - stephen-lazaro:u/slazaro/issue-129274, r=compiler-errors 2024-08-27 00:42:00 +02:00
rustc_builtin_macros Rollup merge of #126013 - nnethercote:unreachable_pub, r=Urgau 2024-08-27 00:41:57 +02:00
rustc_codegen_cranelift Rollup merge of #128731 - RalfJung:simd-shuffle-vector, r=workingjubilee 2024-08-27 01:46:50 -05:00
rustc_codegen_gcc Rollup merge of #128731 - RalfJung:simd-shuffle-vector, r=workingjubilee 2024-08-27 01:46:50 -05:00
rustc_codegen_llvm Rollup merge of #129635 - compiler-errors:unsafe-blocks, r=spastorino 2024-08-27 18:59:28 +02:00
rustc_codegen_ssa Rollup merge of #129418 - petrochenkov:libsearch2, r=jieyouxu 2024-08-27 01:46:51 -05:00
rustc_const_eval Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_data_structures Update indexmap and use IndexMap::append 2024-08-13 16:16:57 -07:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Rollup merge of #129648 - nnethercote:unreachable_pub-2, r=Urgau 2024-08-27 18:59:29 +02:00
rustc_error_codes Add warn(unreachable_pub) to rustc_error_codes. 2024-08-27 11:49:59 +10:00
rustc_error_messages Add warn(unreachable_pub) to rustc_error_messages. 2024-08-27 11:52:08 +10:00
rustc_errors Add warn(unreachable_pub) to rustc_errors. 2024-08-27 12:03:37 +10:00
rustc_expand Add warn(unreachable_pub) to rustc_expand. 2024-08-27 12:40:38 +10:00
rustc_feature Add warn(unreachable_pub) to rustc_feature. 2024-08-27 12:55:54 +10:00
rustc_fluent_macro Add warn(unreachable_pub) to rustc_fluent_macro. 2024-08-27 12:56:54 +10:00
rustc_fs_util Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_graphviz Add warn(unreachable_pub) to rustc_graphviz. 2024-08-27 12:58:29 +10:00
rustc_hir Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_hir_analysis Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_hir_pretty Add warn(unreachable_pub) to rustc_hir_pretty. 2024-08-27 13:25:40 +10:00
rustc_hir_typeck Add warn(unreachable_pub) to rustc_hir_typeck. 2024-08-27 14:22:07 +10:00
rustc_incremental Add warn(unreachable_pub) to rustc_incremental. 2024-08-27 14:30:20 +10:00
rustc_index Add warn(unreachable_pub) to rustc_index. 2024-08-27 14:33:24 +10:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Add warn(unreachable_pub) to rustc_infer. 2024-08-27 14:47:56 +10:00
rustc_interface Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_lexer Add warn(unreachable_pub) to rustc_lexer. 2024-08-27 15:12:46 +10:00
rustc_lint Add warn(unreachable_pub) to rustc_lint. 2024-08-27 15:24:11 +10:00
rustc_lint_defs Add warn(unreachable_pub) to rustc_lint_defs. 2024-08-27 15:25:49 +10:00
rustc_llvm Rollup merge of #129648 - nnethercote:unreachable_pub-2, r=Urgau 2024-08-27 18:59:29 +02:00
rustc_log Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_macros Remove a couple of unused feature enables 2024-08-26 19:52:14 +00:00
rustc_metadata Remove some unnecessary TODOs 2024-08-26 18:44:20 -04:00
rustc_middle Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_mir_build Avoid taking reference of &TyKind 2024-08-25 16:02:29 -04:00
rustc_mir_dataflow rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
rustc_mir_transform Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_monomorphize Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_next_trait_solver Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors 2024-08-14 21:43:07 +08:00
rustc_parse Rollup merge of #128524 - chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot 2024-08-24 21:03:31 -05:00
rustc_parse_format Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_passes Rollup merge of #129544 - mu001999-contrib:dead-code/clean, r=compiler-errors 2024-08-26 01:49:03 +02:00
rustc_pattern_analysis Rollup merge of #128965 - Zalathar:no-pat, r=Nadrieril 2024-08-15 18:44:16 -07:00
rustc_privacy Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_query_impl Simplify some redundant field names 2024-08-21 01:31:42 -04:00
rustc_query_system fix: simple typo in compiler directory 2024-08-20 20:50:32 +08:00
rustc_resolve Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_sanitizers Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu 2024-08-21 18:15:06 +02:00
rustc_serialize Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_session Rollup merge of #129418 - petrochenkov:libsearch2, r=jieyouxu 2024-08-27 01:46:51 -05:00
rustc_smir Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_span Rollup merge of #129487 - GrigorenkoPV:repr_transparent_external_private_fields, r=compiler-errors 2024-08-25 16:51:05 +02:00
rustc_symbol_mangling Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
rustc_target Rollup merge of #129649 - RalfJung:unadjusted-abi-mismatch, r=petrochenkov 2024-08-27 18:59:30 +02:00
rustc_trait_selection Rollup merge of #129590 - compiler-errors:ref-tykind, r=fmease 2024-08-26 01:49:04 +02:00
rustc_traits Remove redundant type ops 2024-08-14 14:18:17 -04:00
rustc_transmute Removes dead code from the compiler 2024-08-25 13:41:39 +08:00
rustc_ty_utils Auto merge of #128506 - compiler-errors:by-move-body, r=cjgillot 2024-08-27 23:30:24 +00:00
rustc_type_ir Rollup merge of #129526 - compiler-errors:fx, r=lqd 2024-08-26 01:49:02 +02:00
rustc_type_ir_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
stable_mir Reformat use declarations. 2024-07-29 08:26:52 +10:00