Skip to content

Commit 32d24f9

Browse files
committed
allow bound regions in writeback
1 parent ae12bc2 commit 32d24f9

File tree

3 files changed

+18
-29
lines changed

3 files changed

+18
-29
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> {

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)