Also closures
This commit is contained in:
parent
966f27977a
commit
dfbb1bfc89
@ -56,7 +56,9 @@ pub fn check_expr_closure(
|
|||||||
// closure sooner rather than later, so first examine the expected
|
// closure sooner rather than later, so first examine the expected
|
||||||
// type, and see if can glean a closure kind from there.
|
// type, and see if can glean a closure kind from there.
|
||||||
let (expected_sig, expected_kind) = match expected.to_option(self) {
|
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),
|
None => (None, None),
|
||||||
};
|
};
|
||||||
let body = self.tcx.hir().body(closure.body);
|
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…
Reference in New Issue
Block a user