diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-02 23:06:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-02 23:06:55 +0100 |
| commit | dc4d38740e914d9abb045e33c0fc08df43b8cdbc (patch) | |
| tree | 2ef98ebfb40f84713d6adcf48e904bd339f3ca7d /compiler/rustc_trait_selection/src | |
| parent | 5ab356fde8f9e607f009f2e30774ae90582b3bb3 (diff) | |
| parent | 9ebbba4ad92ad800d5029fdae34f53aa1e57df5a (diff) | |
| download | rust-dc4d38740e914d9abb045e33c0fc08df43b8cdbc.tar.gz rust-dc4d38740e914d9abb045e33c0fc08df43b8cdbc.zip | |
Rollup merge of #136414 - estebank:expected-return-type, r=oli-obk
Shorten error message for callable with wrong return type
```
error: expected `{closure@...}` to return `Ret`, but it returns `Other`
```
instead of
```
error: expected `{closure@...}` to be a closure that returns `Ret`, but it returns `Other`
```
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index d0a193e8bd5..87dcdcfd665 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -1504,7 +1504,6 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { with_forced_trimmed_paths! { if self.tcx.is_lang_item(projection_term.def_id, LangItem::FnOnceOutput) { - let fn_kind = self_ty.prefix_string(self.tcx); let (span, closure_span) = if let ty::Closure(def_id, _) = self_ty.kind() { let def_span = self.tcx.def_span(def_id); if let Some(local_def_id) = def_id.as_local() @@ -1541,8 +1540,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { _ => self.tcx.short_string(self_ty, file), }; Some((format!( - "expected `{item}` to be a {fn_kind} that returns `{expected_ty}`, but it \ - returns `{normalized_ty}`", + "expected `{item}` to return `{expected_ty}`, but it returns `{normalized_ty}`", ), span, closure_span)) } else if self.tcx.is_lang_item(trait_def_id, LangItem::Future) { Some((format!( |
