Skip to content

Commit e7a21fa

Browse files
committed
Auto merge of #157160 - pbkx:issue-87290-closure-lifetime-test, r=Kivooeo
Add regression test for issue #87290 Issue #87290 is labeled E-needs-test for explicit non-`'static` lifetimes in closure argument types. This adds a check-pass UI test for explicit lifetimes in closure argument types. Fixes #87290.
2 parents e248841 + 5665d70 commit e7a21fa

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Regression test for <https://github.com/rust-lang/rust/issues/87290>.
2+
3+
//@ check-pass
4+
5+
#![crate_type = "lib"]
6+
7+
pub fn f<'a>(_: &'a i32, _: impl FnOnce(&mut &mut &'a i32)) {}
8+
9+
pub fn g<'a>(p: &'a i32) {
10+
f(p, |_: &mut &mut &'a i32| {})
11+
}
12+
13+
pub fn h<'a>(p: &'a i32) {
14+
f(p, |x: &mut &mut &'a i32| {
15+
let _: &mut &mut &'a i32 = x;
16+
})
17+
}

0 commit comments

Comments
 (0)