Skip to content

Commit 088abc5

Browse files
committed
Side-step ICE on RePlaceholder in eval_verify_bound
Address #76168.
1 parent 7807a69 commit 088abc5

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11671167
self.scc_values.elements_contained_in(lower_bound_scc).next().is_none()
11681168
}
11691169

1170+
// FIXME: this is likely to be incorrect, but it side-steps stable ICE #76168,
1171+
// without any changes to what we accept (or reject for that matter).
1172+
VerifyBound::OutlivedBy(ty::RePlaceholder(..)) => false,
1173+
11701174
VerifyBound::OutlivedBy(r) => {
11711175
let r_vid = self.to_region_vid(r);
11721176
self.eval_outlives(r_vid, lower_bound)

src/test/ui/lifetimes/issue-76168.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// edition:2018
2+
#![feature(unboxed_closures)]
3+
use std::future::Future;
4+
5+
async fn wrapper<F>(f: F)
6+
where for<'a> F: FnOnce<(&'a mut i32,)>,
7+
for<'a> <F as FnOnce<(&'a mut i32,)>>::Output: Future<Output=()> + 'a
8+
{ //~ ERROR `<F as FnOnce<(&'a mut i32,)>>::Output` does not live long enough
9+
let mut i = 41;
10+
f(&mut i).await;
11+
}
12+
13+
async fn add_one(i: &mut i32) {
14+
*i = *i + 1;
15+
}
16+
17+
fn main() {}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error: `<F as FnOnce<(&'a mut i32,)>>::Output` does not live long enough
2+
--> $DIR/issue-76168.rs:8:1
3+
|
4+
LL | / {
5+
LL | | let mut i = 41;
6+
LL | | f(&mut i).await;
7+
LL | | }
8+
| |_^
9+
10+
error: aborting due to previous error
11+

0 commit comments

Comments
 (0)