Rollup merge of #149413 - Aditya-PS-05:test-issue-143821-nested-closure-ice, r=JonathanBrouwer
add test for issue 143821 closes rust-lang/rust#143821
This commit is contained in:
commit
60e46fbbe3
1 changed files with 39 additions and 0 deletions
39
tests/ui/borrowck/nested-closure-with-generic-ice.rs
Normal file
39
tests/ui/borrowck/nested-closure-with-generic-ice.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
//@ check-pass
|
||||
// Regression test for issue https://github.com/rust-lang/rust/issues/143821
|
||||
// Tests that we don't ICE when borrow-checking nested closures with generic type parameters
|
||||
// and late-bound lifetime parameters.
|
||||
|
||||
fn data_<T: 'static>(_: &()) -> &T {
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn register<T, F>(f: F) -> IfaceToken<T>
|
||||
where
|
||||
T: 'static,
|
||||
F: FnOnce(&()),
|
||||
{
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn method_with_cr_async<CB>(cb: CB)
|
||||
where
|
||||
CB: Fn(),
|
||||
{
|
||||
loop {}
|
||||
}
|
||||
|
||||
struct IfaceToken<T: 'static>(T);
|
||||
|
||||
fn foo<T>() -> IfaceToken<T> {
|
||||
register::<T, _>(|b: &()| {
|
||||
method_with_cr_async(|| {
|
||||
data_::<T>(&());
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
struct A();
|
||||
|
||||
fn main() {
|
||||
foo::<A>();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue