Change:
<!-- 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. --Removing allows the code to compile successfully. <!-- 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<!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
cc
I dont have too much context on how type folding works, but my guess is we are calling fold sooner that we should. I have this to the for RFC 2229, I'll bring it up during our sync tomorrow.
We want to use .
assign
Error: Parsing assign command in failed: ...'bot assign' ''... Please let know if you're having trouble with this bot.
claim
Thanks

Discussion:
//! then mean that all later passes would have to check for these figments //! and report an error, and it just seems like more mess in the end.) <del> use super::writeback::Resolver; </del> use super::FnCtxt; use crate::expr_use_visitor as euv;

use rustc_infer::infer::UpvarRegion; use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection, ProjectionKind}; use rustc_middle::mir::FakeReadCause; <del> use rustc_middle::ty::fold::TypeFoldable; </del> use rustc_middle::ty::{self, Ty, TyCtxt, TypeckResults, UpvarSubsts}; use rustc_session::lint; use rustc_span::sym;

let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id); if should_do_migration_analysis(self.tcx, closure_hir_id) { <del> self.perform_2229_migration_anaysis(closure_def_id, capture_clause, span, body); </del> <ins> self.perform_2229_migration_anaysis(closure_def_id, capture_clause, span); </ins> } // We now fake capture information for all variables that are mentioned within the closure

closure_def_id: DefId, capture_clause: hir::CaptureBy, span: Span, <del> body: &'tcx hir::Body<'tcx>, </del> ) { let need_migrations = self.compute_2229_migrations( closure_def_id, span, capture_clause, <del> body, </del> self.typeck_results.borrow().closure_min_captures.get(&closure_def_id), );

closure_def_id: DefId, closure_span: Span, closure_clause: hir::CaptureBy, <del> body: &'tcx hir::Body<'tcx>, </del> min_captures: Option<&ty::RootVariableMinCaptureList<'tcx>>, ) -> Vec<hir::HirId> { <del> fn resolve_ty<T: TypeFoldable<'tcx>>( fcx: &FnCtxt<'_, 'tcx>, span: Span, body: &'tcx hir::Body<'tcx>, ty: T, ) -> T { let mut resolver = Resolver::new(fcx, &span, body); ty.fold_with(&mut resolver) } </del> let upvars = if let Some(upvars) = self.tcx.upvars_mentioned(closure_def_id) { upvars } else {

let mut need_migrations = Vec::new(); for (&var_hir_id, _) in upvars.iter() { <del> let ty = resolve_ty(self, closure_span, body, self.node_ty(var_hir_id)); </del> <ins> let ty = self.infcx.resolve_vars_if_possible(self.node_ty(var_hir_id)); </ins> if !ty.needs_drop(self.tcx, self.tcx.param_env(closure_def_id.expect_local())) { continue;

/// The Resolver. This is the type folding engine that detects /// unresolved types and so forth. <del> crate struct Resolver<'cx, 'tcx> { </del> <ins> struct Resolver<'cx, 'tcx> { </ins> tcx: TyCtxt<'tcx>, infcx: &'cx InferCtxt<'cx, 'tcx>, span: &'cx dyn Locatable,

} impl<'cx, 'tcx> Resolver<'cx, 'tcx> { <del> crate fn new( </del> <ins> fn new( </ins> fcx: &'cx FnCtxt<'cx, 'tcx>, span: &'cx dyn Locatable, body: &'tcx hir::Body<'tcx>,

<ins> // run-pass #![warn(disjoint_capture_drop_reorder)] fn main() { if let a = "" { //~^ WARNING: irrefutable `if let` pattern drop(|_: ()| drop(a)); } } </ins>

<ins> warning: irrefutable `if let` pattern --> $DIR/issue-78720.rs:6:5 | LL | /     if let a = "" { LL | | LL | |         drop(|_: ()| drop(a)); LL | |     } | |_____^ | = note: `#[warn(irrefutable_let_patterns)]` on by default = note: this pattern will always match, so the `if let` is useless = help: consider replacing the `if let` with a `let` warning: 1 warning emitted </ins>