diff options
| author | bors <bors@rust-lang.org> | 2021-04-11 05:23:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-11 05:23:11 +0000 |
| commit | 28b948fc5c0163b76c69d792b91a0e83850e7e54 (patch) | |
| tree | 9eb04d3b6916ff1a736da86a61a7af1096f3f2fe | |
| parent | ea1252e7e3282fa8a3163ca424d6ed00a9dbe163 (diff) | |
| parent | 14b4459e8ffc5e07b6261daf6839150d20b6d56b (diff) | |
| download | rust-28b948fc5c0163b76c69d792b91a0e83850e7e54.tar.gz rust-28b948fc5c0163b76c69d792b91a0e83850e7e54.zip | |
Auto merge of #83806 - JohnTitor:issue-51446, r=estebank
Add a regression test for issue-51446 Closes #51446 r? `@estebank`
| -rw-r--r-- | src/test/ui/traits/associated_type_bound/issue-51446.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/ui/traits/associated_type_bound/issue-51446.rs b/src/test/ui/traits/associated_type_bound/issue-51446.rs new file mode 100644 index 00000000000..7dd95de73ba --- /dev/null +++ b/src/test/ui/traits/associated_type_bound/issue-51446.rs @@ -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, |_| ()); +} |
