Skip to content

Commit 57ee169

Browse files
authored
Rollup merge of #146971 - lcnr:fix-writeback, r=BoxyUwU
fix ICE in writeback due to bound regions fixes #117808 r? `@BoxyUwU`
2 parents d10d6bf + 2886ca4 commit 57ee169

File tree

4 files changed

+21
-32
lines changed

4 files changed

+21
-32
lines changed

compiler/rustc_hir_typeck/src/writeback.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,10 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
10031003
}
10041004

10051005
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
1006-
debug_assert!(!r.is_bound(), "Should not be resolving bound region.");
1007-
self.fcx.tcx.lifetimes.re_erased
1006+
match r.kind() {
1007+
ty::ReBound(..) => r,
1008+
_ => self.fcx.tcx.lifetimes.re_erased,
1009+
}
10081010
}
10091011

10101012
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {

compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ where
100100
} else if let Err(guar) = infcx.tcx.check_potentially_region_dependent_goals(root_def_id) {
101101
Err(guar)
102102
} else {
103-
Err(infcx
104-
.dcx()
105-
.delayed_bug(format!("errors selecting obligation during MIR typeck: {errors:?}")))
103+
Err(infcx.dcx().delayed_bug(format!(
104+
"errors selecting obligation during MIR typeck: {name} {root_def_id:?} {errors:?}"
105+
)))
106106
}
107107
})?;
108108

tests/crashes/117808.rs

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//@ edition: 2024
2+
//@ check-pass
3+
//@ compile-flags: -Znext-solver
4+
5+
// This previously ICE'd during writeback when resolving
6+
// the stalled coroutine predicate due to its bound lifetime.
7+
8+
trait Trait<'a> {}
9+
impl<'a, T: Send> Trait<'a> for T {}
10+
11+
fn is_trait<T: for<'a> Trait<'a>>(_: T) {}
12+
fn main() {
13+
is_trait(async {})
14+
}

0 commit comments

Comments
 (0)