diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2018-11-21 10:10:35 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2018-12-30 14:47:12 +0100 |
| commit | 2530ce9fa63a756d655b8e0801b4542c74ec4cae (patch) | |
| tree | e70c7bdb30c4e040c88de308fe28d62c87ce7f0c | |
| parent | 2f42a188d9464427803a609905f12a40248c791d (diff) | |
| download | rust-2530ce9fa63a756d655b8e0801b4542c74ec4cae.tar.gz rust-2530ce9fa63a756d655b8e0801b4542c74ec4cae.zip | |
Add comment.
| -rw-r--r-- | src/librustc_typeck/check/callee.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index f10985a4d0e..c59c143f74b 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -144,6 +144,13 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { _ => {} } + // Now, we look for the implementation of a Fn trait on the object's type. + // We first do it with the explicit instruction to look for an impl of + // `Fn<Tuple>`, with the tuple `Tuple` having an arity corresponding + // to the number of call parameters. + // If that fails (or_else branch), we try again without specifying the + // shape of the tuple (hence the None). This allows to detect an Fn trait + // is implemented, and use this information for diagnostic. self.try_overloaded_call_traits(call_expr, adjusted_ty, Some(arg_exprs)) .or_else(|| self.try_overloaded_call_traits(call_expr, adjusted_ty, None)) .map(|(autoref, method)| { |
