Rollup merge of #97508 - JohnTitor:more-strict-placeholder-dyn-obj, r=pnkfelix
Harden bad placeholder checks on statics/consts Resubmission of #89161 Fixes https://github.com/rust-lang/rust/issues/88643 In #83739, I added a check for trait objects on statics/consts but it wasn't robust. `is_suggestable_infer_ty` fn does a more strict check and finds more bad placeholders. See https://github.com/rust-lang/rust/pull/89161#issuecomment-934690300 for the more detailed explanation. r? `@pnkfelix` as you're the reviewer of the previous PR
This commit is contained in:
commit
aa71be1b39
9 changed files with 75 additions and 9 deletions
|
@ -806,8 +806,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::ItemId) {
|
|||
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 {
|
||||
if !is_suggestable_infer_ty(ty) {
|
||||
let mut visitor = HirPlaceholderCollector::default();
|
||||
visitor.visit_item(it);
|
||||
placeholder_type_error(tcx, None, visitor.0, false, None, it.kind.descr());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue