diff options
| author | Yuki Okushi <yuki.okushi@huawei.com> | 2021-06-10 12:06:47 +0900 |
|---|---|---|
| committer | Yuki Okushi <yuki.okushi@huawei.com> | 2021-06-10 12:06:47 +0900 |
| commit | 052d77ea5669380fafbc210b517e51f7c7281c68 (patch) | |
| tree | d8ec00af7a7140650cdb36efa49e3a65463edb75 /compiler | |
| parent | eab201df7028ebb6812c0b1a01702ac6ecfcceed (diff) | |
| download | rust-052d77ea5669380fafbc210b517e51f7c7281c68.tar.gz rust-052d77ea5669380fafbc210b517e51f7c7281c68.zip | |
Account for bad placeholder errors on consts/statics with trait objects
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_typeck/src/collect.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/collect.rs b/compiler/rustc_typeck/src/collect.rs index ee3ac3b62d9..89bfb77b855 100644 --- a/compiler/rustc_typeck/src/collect.rs +++ b/compiler/rustc_typeck/src/collect.rs @@ -808,6 +808,14 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) { match it.kind { hir::ItemKind::Fn(..) => tcx.ensure().fn_sig(def_id), hir::ItemKind::OpaqueTy(..) => tcx.ensure().item_bounds(def_id), + hir::ItemKind::Const(ty, ..) | hir::ItemKind::Static(ty, ..) => { + // (#75889): Account for `const C: dyn Fn() -> _ = "";` + 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); + } + } _ => (), } } |
