diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs index 853a4142907..82feebc8029 100644 --- a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -118,7 +118,7 @@ pub(super) fn try_report_static_impl_trait(&self) -> Option { "alternatively, add an explicit `'static` bound to this reference"; let plus_lt = format!(" + {}", lifetime_name); match fn_return.kind { - TyKind::Def(item_id, _) => { + TyKind::OpaqueDef(item_id, _) => { let item = self.tcx().hir().item(item_id.id); let opaque = if let ItemKind::OpaqueTy(opaque) = &item.kind { opaque