Open farnoy opened 6 days ago
Bisects to #125958, cc PR author @BoxyUwU -- ah but it's likely a duplicate of #126378 and so forth.
this is stable and doesn't use effects, so it's probably different
@Nilstrieb I'm going from https://github.com/rust-lang/rust/issues/126889#issuecomment-2186556089
I cannot reproduce this locally
edit: oh --release
is required
Assigning @compiler-errors since he said he'd take a look at this after I figured out that this is a mess to fix.
The tl;dr here is that pre-monomorphization we wind up trying to instance drop glue.
The logic for creating drop glue should be able to assume that it is in a post-monomorphization state where using an empty ParamEnv
is fine. Because we try to instance drop glue with generic types (e.g. Foo<N>
) this means that we need to actually be using the ParamEnv
of the body that is instancing the drop glue instead. This turns out to be quite involved to fix and not as simple as other "pass the correct param env in" bug fixes.
The... good ish? bad? news ? is that we've been getting this wrong for much longer than my PR, my PR only surfaced this due to the fact that it relies on us providing the correct ParamEnv
everywhere in the compiler which apparently is not the case :-)
edit: I suspect the principled solution here is to have two codepaths (that share logic) for generating mir shims. One for instancing stuff post mono that behaves how monomorphization should be behaving and can use an empty Reveal::All
env. And one for when we want to generate the mir pre-mono and it's as if we're putting the mir inline into some other body in which cases we need to be using the ParamEnv
of the body we're placing the shim's mir into`.
To avoid breaking stuff when beta gets bumped to stable we probably want to try the following:
--release
and see if its viable to backport a change to stop doing that to mask the bug for a cycleConst::ty
removal on beta onlyAnd then when that's done try to land the principled refactoring before the next beta cutoff
This should be fixed on nightly, awaiting a beta backport
Repro steps:
I did not bisect, but
nightly-2024-04-15
does work just fine