Skip to content

Commit

Permalink
Auto merge of rust-lang#83806 - JohnTitor:issue-51446, r=estebank
Browse files Browse the repository at this point in the history
Add a regression test for issue-51446

Closes rust-lang#51446
r? `@estebank`
  • Loading branch information
bors committed Apr 11, 2021
2 parents ea1252e + 14b4459 commit 28b948f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/test/ui/traits/associated_type_bound/issue-51446.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Regression test for #51446.
// check-pass

trait Foo {
type Item;
fn get(&self) -> Self::Item;
}

fn blah<T, F>(x: T, f: F) -> B<T::Item, impl Fn(T::Item)>
where
T: Foo,
F: Fn(T::Item),
{
B { x: x.get(), f }
}

pub struct B<T, F>
where
F: Fn(T),
{
pub x: T,
pub f: F,
}

impl Foo for i32 {
type Item = i32;
fn get(&self) -> i32 {
*self
}
}

fn main() {
let _ = blah(0, |_| ());
}

0 comments on commit 28b948f

Please sign in to comment.