mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #146971 - lcnr:fix-writeback, r=BoxyUwU
fix ICE in writeback due to bound regions fixes rust-lang/rust#117808 r? `@BoxyUwU`
This commit is contained in:
@@ -1003,8 +1003,10 @@ fn cx(&self) -> TyCtxt<'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> {
|
||||
|
||||
@@ -100,9 +100,9 @@ pub fn scrape_region_constraints<'tcx, Op, R>(
|
||||
} else if let Err(guar) = infcx.tcx.check_potentially_region_dependent_goals(root_def_id) {
|
||||
Err(guar)
|
||||
} else {
|
||||
Err(infcx
|
||||
.dcx()
|
||||
.delayed_bug(format!("errors selecting obligation during MIR typeck: {errors:?}")))
|
||||
Err(infcx.dcx().delayed_bug(format!(
|
||||
"errors selecting obligation during MIR typeck: {name} {root_def_id:?} {errors:?}"
|
||||
)))
|
||||
}
|
||||
})?;
|
||||
|
||||
|
||||
@@ -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,
|
||||
{
|
||||
}
|
||||
@@ -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 {})
|
||||
}
|
||||
Reference in New Issue
Block a user