Change:
error: any use of this value will cause an error <del> --> $DIR/uninhabited-const-issue-61744.rs:8:5 </del> <ins> --> $DIR/uninhabited-const-issue-61744.rs:4:5 </ins> | <del> LL |     fake_type() |     ^^^^^^^^^^^ </del> <ins> LL |     hint_unreachable() |     ^^^^^^^^^^^^^^^^^^ </ins> |     | <del> |     tried to call a function with return type T passing return place of type ! </del> <ins> |     reached the configured maximum number of stack frames </ins> |     inside call to `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:4:5 <ins> |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 |     inside call to `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:8:5 </ins> |     inside call to `fake_type::<i32>` at $DIR/uninhabited-const-issue-61744.rs:12:36 ... LL |     const CONSTANT: i32 = unsafe { fake_type() };

Discussion:
Since we have a strange condition in the Miri/interpreter code that checks if a function got called with appropriate arguments: got replaced by . That's really strange, the layout should contain all the information we need for execution, and module boundaries certainly shouldn't matter for the call ABI. So I don't think this change is right, at least not for Miri. Unfortunately, there is 0 explanation of the "why" in that PR and in the code. It also does fix an ICE. Is this a case of running the interpreter on untyped code? Or why does looking at the layout not work? Cc
This is entirely my fault and also entirely unnecessary for fixing the ICE. I just believed this to be a useful cleanup: The reason is that computing the layout in a cached way (via ) requires that we actually have an IndexVec of locals, which we don't have for const prop. The previous code was so if you prefer that, I'm fine with moving there, I just thought it to be better to fix the problem at the layout checking place instead of at the layout computation place.
I'm afraid I disagree with that being a cleanup -- AFAIK the type-based tests exist for surface language stuff, like exhaustiveness check and whatnot, also taking into account semver considerations. But for the interpreter I'd like to be sure that we use the layout information that will also be used by codegen. constprop making a mess for everyone else, again. :( That other code seems okay to me, the comment is confusing though. What does that have to do with "constants being trivial"? And "don't allocate any locals" sounds like we wouldn't make them , which is not at all what this is about. But if that explains that might be empty when we are in constprop, I'd r+ that.
actually, has just made some changes there or is in the process of further changes. We may be able to revert after those changes are through because we'll have an actual stack frame available
That would be great! I thought there were some performance reasons for this.
There were strong performance reasons in the past. We alleviated most of them, but there are some left: not even 2% regression in artificial const eval benchmarks are fine with me for the enormous reduction in code complexity and duplication.

We may be able to find further improvements that help const prop and const eval now that they have started sharing more code.
Besides this issue here, do we carry existing hacks that we can remove with the more well-behaved const_prop?
I think there are some hacks about fallback behaviour on empty stacks