X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_typeck%2Fcheck%2Fmethod%2Fsuggest.rs;h=e63366966636a7d7a493ce21805b6653189f8ab6;hb=b423a0f9ef488ca4cd9ff620a44566bb441eb21f;hp=064259c171d91bb638192068bc2fbfd4e2a757b0;hpb=298346dd5bf8211e879ef6750398a1e7d1226c7e;p=rust.git diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 064259c171d..e6336696663 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -101,7 +101,7 @@ macro_rules! span_did_you_mean { match field_ty.sty { // Not all of these (e.g. unsafe fns) implement FnOnce // so we look for these beforehand - ty::TyClosure(..) | ty::TyBareFn(..) => { + ty::TyClosure(..) | ty::TyFnDef(..) | ty::TyFnPtr(_) => { span_stored_function!(); } // If it's not a simple function, look for things which implement FnOnce @@ -271,7 +271,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, for (i, trait_did) in candidates.iter().enumerate() { err.fileline_help(span, - &*format!("candidate #{}: use `{}`", + &format!("candidate #{}: `use {}`", i + 1, fcx.tcx().item_path_str(*trait_did))); } @@ -316,7 +316,7 @@ fn suggest_traits_to_import<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, for (i, trait_info) in candidates.iter().enumerate() { err.fileline_help(span, - &*format!("candidate #{}: `{}`", + &format!("candidate #{}: `{}`", i + 1, fcx.tcx().item_path_str(trait_info.def_id))); }