Add blanket impls to allow the various Fn traits to be interconverted.

Fixes #18387.
This commit is contained in:
Niko Matsakis 2014-10-28 07:24:25 -04:00
parent 63c4f22f2b
commit 680d579ff0
10 changed files with 221 additions and 26 deletions

View file

@ -804,12 +804,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
&candidates[i],
&candidates[j]));
if is_dup {
debug!("Dropping candidate #{}/#{}: {}",
debug!("Dropping candidate #{}/{}: {}",
i, candidates.len(), candidates[i].repr(self.tcx()));
candidates.swap_remove(i);
} else {
debug!("Retaining candidate #{}/#{}",
i, candidates.len());
debug!("Retaining candidate #{}/{}: {}",
i, candidates.len(), candidates[i].repr(self.tcx()));
i += 1;
}
}

View file

@ -3493,6 +3493,11 @@ fn check_expr_with_unifier(fcx: &FnCtxt,
ast::FnOnceUnboxedClosureKind => ty::FnOnceUnboxedClosureKind,
};
debug!("unboxed_closure for {} --> sig={} kind={}",
local_def(expr.id).repr(fcx.tcx()),
fn_ty.sig.repr(fcx.tcx()),
kind);
let unboxed_closure = ty::UnboxedClosure {
closure_type: fn_ty,
kind: kind,