Also closures

This commit is contained in:
Michael Goulet 2023-10-05 00:05:04 +00:00
parent 966f27977a
commit dfbb1bfc89
2 changed files with 15 additions and 1 deletions

View File

@ -56,7 +56,9 @@ pub fn check_expr_closure(
// closure sooner rather than later, so first examine the expected
// type, and see if can glean a closure kind from there.
let (expected_sig, expected_kind) = match expected.to_option(self) {
Some(ty) => self.deduce_closure_signature(ty),
Some(ty) => {
self.deduce_closure_signature(self.try_structurally_resolve_type(expr_span, ty))
}
None => (None, None),
};
let body = self.tcx.hir().body(closure.body);

View File

@ -0,0 +1,12 @@
// compile-flags: -Ztrait-solver=next
// check-pass
#![feature(return_position_impl_trait_in_trait)]
trait Foo {
fn test() -> impl Fn(u32) -> u32 {
|x| x.count_ones()
}
}
fn main() {}