diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2014-11-03 12:36:48 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2014-11-05 22:01:30 -0500 |
| commit | f7914739379711e9f56fdcfab049b5a9531feb52 (patch) | |
| tree | 361fac00c784ef21115b1112f2c26e30edf0f2dd | |
| parent | 680d579ff0e0c8e65e329d29b867600aa2aec478 (diff) | |
Reverse order of lookup
| -rw-r--r-- | src/librustc/middle/typeck/check/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index 88b191b9a82..bcb875a6aa8 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2147,11 +2147,11 @@ fn try_overloaded_call<'a>(fcx: &FnCtxt, _ => {} } - // Try `FnOnce`, then `FnMut`, then `Fn`. + // Try the options that are least restrictive on the caller first. for &(maybe_function_trait, method_name) in [ - (fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")), + (fcx.tcx().lang_items.fn_trait(), token::intern("call")), (fcx.tcx().lang_items.fn_mut_trait(), token::intern("call_mut")), - (fcx.tcx().lang_items.fn_trait(), token::intern("call")) + (fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")), ].iter() { let function_trait = match maybe_function_trait { None => continue, |
