Change:
Previously: Now: <!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: <!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p</p</details
Inlining exposes a use of unnormalized local in a call terminator (not sure if this is more of an issue with inlining or a validator): Note: revision annotation doesn't work in an auxiliary file (so it isn't tested on CI with mir-opt-level=2). modify labels: +A-mir-opt-inlining
This ICEs again because the fix was reverted Can someone reopen please?
Due to this new requires to trigger. <details<summaryICE:</summary</details
(FWIW can also trigger this: )
fixes this for and , but it still ICEs with on its own or with mir-opt-level 1/2 cc

Discussion:
impl<'tcx> MirPass<'tcx> for Validator { fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { let def_id = body.source.def_id(); <del> let param_env = tcx.param_env(def_id); </del> <ins> // We need to param_env_reveal_all_normalized, as some optimizations // change types in ways that require unfolding opaque types. let param_env = tcx.param_env_reveal_all_normalized(def_id); </ins> let mir_phase = self.mir_phase; let always_live_locals = AlwaysLiveLocals::new(body);

} // Normalize lifetimes away on both sides, then compare. <del> let param_env = param_env.with_reveal_all_normalized(tcx); </del> let normalize = |ty: Ty<'tcx>| { tcx.normalize_erasing_regions( param_env,

return true; } // Normalize projections and things like that. <del> // FIXME: We need to reveal_all, as some optimizations change types in ways // that require unfolding opaque types. let param_env = self.param_env.with_reveal_all_normalized(self.tcx); let src = self.tcx.normalize_erasing_regions(param_env, src); let dest = self.tcx.normalize_erasing_regions(param_env, dest); </del> <ins> let src = self.tcx.normalize_erasing_regions(self.param_env, src); let dest = self.tcx.normalize_erasing_regions(self.param_env, dest); </ins> // Type-changing assignments can happen when subtyping is used. While // all normal lifetimes are erased, higher-ranked types with their // late-bound lifetimes are still around and can lead to type // differences. So we compare ignoring lifetimes. <del> equal_up_to_regions(self.tcx, param_env, src, dest) </del> <ins> equal_up_to_regions(self.tcx, self.param_env, src, dest) </ins> } }

} TerminatorKind::Call { func, args, destination, cleanup, .. } => { let func_ty = func.ty(&self.body.local_decls, self.tcx); <ins> let func_ty = self.tcx.normalize_erasing_regions(self.param_env, func_ty); </ins> match func_ty.kind() { ty::FnPtr(..) | ty::FnDef(..) => {} _ => self.fail(

<del> // revisions: default miropt //[miropt]compile-flags: -Z mir-opt-level=2 // ~^ This flag is for #77668, it used to be ICE. </del> #![crate_type = "lib"] pub fn bar<P>( // Error won't happen if "bar" is not generic

<del> // run-pass </del> <ins> // Regression test for various issues related to normalization & inlining. // * #68347, #77306, #77668 - missed normalization during inlining. // * #78442 - missed normalization in validator after inlining. // // build-pass </ins> // compile-flags:-Zmir-opt-level=2 <del> // Previously ICEd because we did not normalize during inlining, // see https://github.com/rust-lang/rust/pull/77306 for more discussion. </del> pub fn write() { create()() } <ins> pub fn write_generic<T>(_t: T) { hide()(); } </ins> pub fn create() -> impl FnOnce() { || () } <ins> pub fn hide() -> impl Fn() { write } </ins> fn main() { write(); <ins> write_generic(()); </ins> }