Skip to content

Commit f791473

Browse files
committed
Reverse order of lookup
1 parent 680d579 commit f791473

File tree

1 file changed

+3
-3
lines changed
  • src/librustc/middle/typeck/check

1 file changed

+3
-3
lines changed

src/librustc/middle/typeck/check/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2147,11 +2147,11 @@ fn try_overloaded_call<'a>(fcx: &FnCtxt,
21472147
_ => {}
21482148
}
21492149

2150-
// Try `FnOnce`, then `FnMut`, then `Fn`.
2150+
// Try the options that are least restrictive on the caller first.
21512151
for &(maybe_function_trait, method_name) in [
2152-
(fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")),
2152+
(fcx.tcx().lang_items.fn_trait(), token::intern("call")),
21532153
(fcx.tcx().lang_items.fn_mut_trait(), token::intern("call_mut")),
2154-
(fcx.tcx().lang_items.fn_trait(), token::intern("call"))
2154+
(fcx.tcx().lang_items.fn_once_trait(), token::intern("call_once")),
21552155
].iter() {
21562156
let function_trait = match maybe_function_trait {
21572157
None => continue,

0 commit comments

Comments
 (0)