diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index 734a5b4972bcc..82c4eba482795 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -1167,6 +1167,10 @@ impl<'tcx> RegionInferenceContext<'tcx> { self.scc_values.elements_contained_in(lower_bound_scc).next().is_none() } + // FIXME: this is likely to be incorrect, but it side-steps stable ICE #76168, + // without any changes to what we accept (or reject for that matter). + VerifyBound::OutlivedBy(ty::RePlaceholder(..)) => false, + VerifyBound::OutlivedBy(r) => { let r_vid = self.to_region_vid(r); self.eval_outlives(r_vid, lower_bound) diff --git a/src/test/ui/lifetimes/issue-76168.rs b/src/test/ui/lifetimes/issue-76168.rs new file mode 100644 index 0000000000000..614835d5d9a5f --- /dev/null +++ b/src/test/ui/lifetimes/issue-76168.rs @@ -0,0 +1,17 @@ +// edition:2018 +#![feature(unboxed_closures)] +use std::future::Future; + +async fn wrapper(f: F) +where for<'a> F: FnOnce<(&'a mut i32,)>, + for<'a> >::Output: Future + 'a +{ //~ ERROR `>::Output` does not live long enough + let mut i = 41; + f(&mut i).await; +} + +async fn add_one(i: &mut i32) { + *i = *i + 1; +} + +fn main() {} diff --git a/src/test/ui/lifetimes/issue-76168.stderr b/src/test/ui/lifetimes/issue-76168.stderr new file mode 100644 index 0000000000000..bb79c6ede036a --- /dev/null +++ b/src/test/ui/lifetimes/issue-76168.stderr @@ -0,0 +1,11 @@ +error: `>::Output` does not live long enough + --> $DIR/issue-76168.rs:8:1 + | +LL | / { +LL | | let mut i = 41; +LL | | f(&mut i).await; +LL | | } + | |_^ + +error: aborting due to previous error +