Skip to content

Commit

Permalink
Fix an ICE in conflict errors diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Apr 28, 2023
1 parent b29b56f commit 754a62c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 315 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}

// Get closure's arguments
let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else { unreachable!() };
let ty::Closure(_, substs) = typeck_results.expr_ty(closure_expr).kind() else { /* hir::Closure can be a generator too */ return };
let sig = substs.as_closure().sig();
let tupled_params =
tcx.erase_late_bound_regions(sig.inputs().iter().next().unwrap().map_bound(|&b| b));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// edition:2021
// compile-flags: -Zdrop-tracking-mir=yes
// failure-status: 101
#![feature(generators)]

fn main() {
let x = &mut ();
|| {
let _c = || yield *&mut *x;
|| _ = &mut *x;
//~^ cannot borrow `*x` as mutable more than once at a time
};
}
Loading

0 comments on commit 754a62c

Please sign in to comment.