We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 680d579 commit f791473Copy full SHA for f791473
src/librustc/middle/typeck/check/mod.rs
@@ -2147,11 +2147,11 @@ fn try_overloaded_call<'a>(fcx: &FnCtxt,
2147
_ => {}
2148
}
2149
2150
- // Try `FnOnce`, then `FnMut`, then `Fn`.
+ // Try the options that are least restrictive on the caller first.
2151
for &(maybe_function_trait, method_name) in [
2152
- (fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")),
+ (fcx.tcx().lang_items.fn_trait(), token::intern("call")),
2153
(fcx.tcx().lang_items.fn_mut_trait(), token::intern("call_mut")),
2154
- (fcx.tcx().lang_items.fn_trait(), token::intern("call"))
+ (fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")),
2155
].iter() {
2156
let function_trait = match maybe_function_trait {
2157
None => continue,
0 commit comments