diff options
| author | bors <bors@rust-lang.org> | 2023-12-03 14:26:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-03 14:26:39 +0000 |
| commit | 21d88b32cb5ff05b7a43c99e7c508bbbc65e036d (patch) | |
| tree | 0d96f31b77c8387da48e9aa4efd0376c787a23d3 /compiler | |
| parent | 8b6a4a93ed1bf637718e28ed266a5f6d70c2776d (diff) | |
| parent | a2171feb3384d5737eaf7ca24c5740a9615b2917 (diff) | |
| download | rust-21d88b32cb5ff05b7a43c99e7c508bbbc65e036d.tar.gz rust-21d88b32cb5ff05b7a43c99e7c508bbbc65e036d.zip | |
Auto merge of #118526 - sjwang05:issue-118510, r=petrochenkov
Fix ICE: `fn_arg_names: unexpected item DefId(..)` Fixes #118510
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index d5e1efb9663..6b231a30ea7 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2112,7 +2112,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { && !expected_inputs.is_empty() && expected_inputs.len() == found_inputs.len() && let Some(typeck) = &self.typeck_results - && let Res::Def(_, fn_def_id) = typeck.qpath_res(&path, *arg_hir_id) + && let Res::Def(res_kind, fn_def_id) = typeck.qpath_res(&path, *arg_hir_id) + && res_kind.is_fn_like() { let closure: Vec<_> = self .tcx @@ -2155,7 +2156,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { .map(|(name, ty)| { format!( "{name}{}", - if ty.has_infer_types() { String::new() } else { format!(": {ty}") } + if ty.has_infer_types() { + String::new() + } else if ty.references_error() { + ": /* type */".to_string() + } else { + format!(": {ty}") + } ) }) .collect(); |
