Skip to content

Commit 14b4459

Browse files
committed
Add a regression test for issue-51446
1 parent 836c317 commit 14b4459

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Regression test for #51446.
2+
// check-pass
3+
4+
trait Foo {
5+
type Item;
6+
fn get(&self) -> Self::Item;
7+
}
8+
9+
fn blah<T, F>(x: T, f: F) -> B<T::Item, impl Fn(T::Item)>
10+
where
11+
T: Foo,
12+
F: Fn(T::Item),
13+
{
14+
B { x: x.get(), f }
15+
}
16+
17+
pub struct B<T, F>
18+
where
19+
F: Fn(T),
20+
{
21+
pub x: T,
22+
pub f: F,
23+
}
24+
25+
impl Foo for i32 {
26+
type Item = i32;
27+
fn get(&self) -> i32 {
28+
*self
29+
}
30+
}
31+
32+
fn main() {
33+
let _ = blah(0, |_| ());
34+
}

0 commit comments

Comments
 (0)