Skip to content

Commit 56ea366

Browse files
committed
add test for Failed to normalize closure with TAIT rust-lang#109020
Fixes rust-lang#109020
1 parent 5e0d8c3 commit 56ea366

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// ICE Failed to normalize closure with TAIT
2+
// issue: rust-lang/rust#109020
3+
//@ check-pass
4+
5+
#![feature(type_alias_impl_trait)]
6+
7+
use std::marker::PhantomData;
8+
9+
type WithEmplacableForFn<'a> = impl EmplacableFn + 'a;
10+
11+
fn with_emplacable_for<'a, F, R>(mut f: F) -> R
12+
where
13+
F: for<'b> FnMut(Emplacable<WithEmplacableForFn<'b>>) -> R,
14+
{
15+
fn with_emplacable_for_inner<'a, R>(
16+
_: &'a (),
17+
_: &mut dyn FnMut(Emplacable<WithEmplacableForFn<'a>>) -> R,
18+
) -> R {
19+
fn _constrain(_: &mut ()) -> WithEmplacableForFn<'_> {
20+
()
21+
}
22+
loop {}
23+
}
24+
25+
with_emplacable_for_inner(&(), &mut f)
26+
}
27+
28+
trait EmplacableFn {}
29+
30+
impl EmplacableFn for () {}
31+
32+
struct Emplacable<F>
33+
where
34+
F: EmplacableFn,
35+
{
36+
phantom: PhantomData<F>,
37+
}
38+
39+
fn main() {
40+
with_emplacable_for(|_| {});
41+
}

0 commit comments

Comments
 (0)