diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index f741606370fb..91e65cffc58c 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -839,7 +839,15 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { if let hir::TyKind::TraitObject(..) = ty.kind { let mut visitor = PlaceholderHirTyCollector::default(); visitor.visit_item(it); - placeholder_type_error(tcx, None, &[], visitor.0, false, None); + placeholder_type_error( + tcx, + None, + &[], + visitor.0, + false, + None, + it.kind.descr(), + ); } } _ => (), diff --git a/src/test/ui/typeck/issue-75889.stderr b/src/test/ui/typeck/issue-75889.stderr index 0a8a3c9e7433..de4bdf4e6d9d 100644 --- a/src/test/ui/typeck/issue-75889.stderr +++ b/src/test/ui/typeck/issue-75889.stderr @@ -1,10 +1,10 @@ -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for constant items --> $DIR/issue-75889.rs:3:24 | LL | const FOO: dyn Fn() -> _ = ""; | ^ not allowed in type signatures -error[E0121]: the type placeholder `_` is not allowed within types on item signatures +error[E0121]: the type placeholder `_` is not allowed within types on item signatures for static items --> $DIR/issue-75889.rs:4:25 | LL | static BOO: dyn Fn() -> _ = "";