From f7914739379711e9f56fdcfab049b5a9531feb52 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 3 Nov 2014 12:36:48 -0500 Subject: [PATCH] Reverse order of lookup --- src/librustc/middle/typeck/check/mod.rs | 6 +++--- 1 file 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,