diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-01-06 20:28:46 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-01-30 21:51:35 +0000 |
| commit | 6c2c8edac3f7aa2d2aa779d0683db7f3dd2e9887 (patch) | |
| tree | f7f47609166d90b6f736844b09f8b4410b0c2089 /compiler/rustc_trait_selection | |
| parent | 5ae8e238169586d8af4bb61b980c2bd4bfb71b86 (diff) | |
Tweak E0271 wording
Diffstat (limited to 'compiler/rustc_trait_selection')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index e9842b2cba5..df6ce2777cf 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1866,10 +1866,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { with_forced_trimmed_paths! { if Some(pred.projection_ty.def_id) == self.tcx.lang_items().fn_once_output() { + let fn_kind = self_ty.prefix_string(self.tcx); + let item = match self_ty.kind() { + ty::FnDef(def, _) => self.tcx.item_name(*def).to_string(), + _ => self_ty.to_string(), + }; Some(format!( - "expected `{self_ty}` to be a {fn_kind} that returns `{expected_ty}`, but it \ + "expected `{item}` to be a {fn_kind} that returns `{expected_ty}`, but it \ returns `{normalized_ty}`", - fn_kind = self_ty.prefix_string(self.tcx) )) } else if Some(trait_def_id) == self.tcx.lang_items().future_trait() { Some(format!( |
