Skip to content

Commit

Permalink
Also closures
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 5, 2023
1 parent 966f279 commit dfbb1bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compiler/rustc_hir_typeck/src/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// 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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit dfbb1bf

Please sign in to comment.