Also closures
This commit is contained in:
parent
966f27977a
commit
dfbb1bfc89
2 changed files with 15 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue