Auto merge of #83806 - JohnTitor:issue-51446, r=estebank
Add a regression test for issue-51446 Closes #51446 r? `@estebank`
This commit is contained in:
commit
28b948fc5c
1 changed files with 34 additions and 0 deletions
34
src/test/ui/traits/associated_type_bound/issue-51446.rs
Normal file
34
src/test/ui/traits/associated_type_bound/issue-51446.rs
Normal file
|
@ -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, |_| ());
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue