rust/compiler/rustc_const_eval/src/interpret
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
..
call.rs Stop using a special inner body for the coroutine by-move body for async closures 2024-08-26 18:44:19 -04:00
cast.rs Avoid taking reference of &TyKind 2024-08-25 16:02:29 -04:00
discriminant.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
eval_context.rs interpret: refactor function call handling to be better-abstracted 2024-08-06 11:08:12 +02:00
intern.rs rename CompileTimeInterpreter -> CompileTimeMachine, CompileTimeEvalContext -> CompileTimeInterpCx 2024-06-13 20:30:11 +02:00
intrinsics.rs Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errors 2024-08-14 00:56:53 +00:00
machine.rs Auto merge of #128742 - RalfJung:miri-vtable-uniqueness, r=saethlin 2024-08-13 04:32:34 +00:00
memory.rs Rollup merge of #128942 - RalfJung:interpret-weak-memory, r=saethlin 2024-08-27 01:46:51 -05:00
mod.rs interpret: refactor function call handling to be better-abstracted 2024-08-06 11:08:12 +02:00
operand.rs interpret: ImmTy: tighten sanity checks in offset logic 2024-08-24 15:12:30 +02:00
operator.rs interpret: move nullary-op evaluation into operator.rs 2024-08-05 22:42:34 +02:00
place.rs miri: make vtable addresses not globally unique 2024-08-06 19:09:31 +02:00
projection.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
stack.rs Shrink TyKind::FnPtr. 2024-08-09 14:33:25 +10:00
step.rs rename AddressOf -> RawBorrow inside the compiler 2024-08-18 19:46:53 +02:00
traits.rs miri: make vtable addresses not globally unique 2024-08-06 19:09:31 +02:00
util.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
validity.rs Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errors 2024-08-14 00:56:53 +00:00
visitor.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00