Skip to content

Commit dfbb1bf

Browse files
Also closures
1 parent 966f279 commit dfbb1bf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

compiler/rustc_hir_typeck/src/closure.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
5656
// closure sooner rather than later, so first examine the expected
5757
// type, and see if can glean a closure kind from there.
5858
let (expected_sig, expected_kind) = match expected.to_option(self) {
59-
Some(ty) => self.deduce_closure_signature(ty),
59+
Some(ty) => {
60+
self.deduce_closure_signature(self.try_structurally_resolve_type(expr_span, ty))
61+
}
6062
None => (None, None),
6163
};
6264
let body = self.tcx.hir().body(closure.body);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// compile-flags: -Ztrait-solver=next
2+
// check-pass
3+
4+
#![feature(return_position_impl_trait_in_trait)]
5+
6+
trait Foo {
7+
fn test() -> impl Fn(u32) -> u32 {
8+
|x| x.count_ones()
9+
}
10+
}
11+
12+
fn main() {}

0 commit comments

Comments
 (0)