allow bound regions in writeback

This commit is contained in:
lcnr 2025-09-24 13:02:27 +02:00
parent ae12bc21d8
commit 32d24f9efa
3 changed files with 18 additions and 29 deletions

View file

@ -1003,8 +1003,10 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Resolver<'cx, 'tcx> {
}
fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> {
debug_assert!(!r.is_bound(), "Should not be resolving bound region.");
self.fcx.tcx.lifetimes.re_erased
match r.kind() {
ty::ReBound(..) => r,
_ => self.fcx.tcx.lifetimes.re_erased,
}
}
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {

View file

@ -1,27 +0,0 @@
//@ known-bug: #117808
//@ edition:2021
//@ needs-rustc-debug-assertions
use std::future::Future;
fn hrc<R, F: for<'a> AsyncClosure<'a, (), R>>(f: F) -> F {
f
}
fn main() {
hrc(|x| async {});
}
trait AsyncClosure<'a, I, R>
where
I: 'a,
{
}
impl<'a, I, R, Fut, F> AsyncClosure<'a, I, R> for F
where
I: 'a,
F: Fn(&'a I) -> Fut,
Fut: Future<Output = R> + Send + 'a,
{
}

View file

@ -0,0 +1,14 @@
//@ edition: 2024
//@ check-pass
//@ compile-flags: -Znext-solver
// This previously ICE'd during writeback when resolving
// the stalled coroutine predicate due to its bound lifetime.
trait Trait<'a> {}
impl<'a, T: Send> Trait<'a> for T {}
fn is_trait<T: for<'a> Trait<'a>>(_: T) {}
fn main() {
is_trait(async {})
}