@@ -760,7 +760,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
760760 let trait_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
761761
762762 let ( generics, kind) = match i. kind {
763- AssocItemKind :: Const ( ref ty, ref default) => {
763+ AssocItemKind :: Static ( ref ty, _, ref default) // Let's pretend this is a `const`.
764+ | AssocItemKind :: Const ( ref ty, ref default) => {
764765 let ty = self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) ;
765766 let body = default. as_ref ( ) . map ( |x| self . lower_const_body ( i. span , Some ( x) ) ) ;
766767 ( hir:: Generics :: empty ( ) , hir:: TraitItemKind :: Const ( ty, body) )
@@ -802,7 +803,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
802803
803804 fn lower_trait_item_ref ( & mut self , i : & AssocItem ) -> hir:: TraitItemRef {
804805 let ( kind, has_default) = match & i. kind {
805- AssocItemKind :: Const ( _, default) => ( hir:: AssocItemKind :: Const , default. is_some ( ) ) ,
806+ AssocItemKind :: Static ( _, _, default) // Let's pretend this is a `const` for recovery.
807+ | AssocItemKind :: Const ( _, default) => {
808+ ( hir:: AssocItemKind :: Const , default. is_some ( ) )
809+ }
806810 AssocItemKind :: TyAlias ( _, _, default) => ( hir:: AssocItemKind :: Type , default. is_some ( ) ) ,
807811 AssocItemKind :: Fn ( sig, _, default) => {
808812 ( hir:: AssocItemKind :: Method { has_self : sig. decl . has_self ( ) } , default. is_some ( ) )
@@ -827,7 +831,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
827831 let impl_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
828832
829833 let ( generics, kind) = match i. kind {
830- AssocItemKind :: Const ( ref ty, ref expr) => {
834+ AssocItemKind :: Static ( ref ty , _ , ref expr ) | AssocItemKind :: Const ( ref ty, ref expr) => {
831835 let ty = self . lower_ty ( ty, ImplTraitContext :: disallowed ( ) ) ;
832836 (
833837 hir:: Generics :: empty ( ) ,
@@ -895,7 +899,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
895899 vis : self . lower_visibility ( & i. vis , Some ( i. id ) ) ,
896900 defaultness : self . lower_defaultness ( i. defaultness , true /* [1] */ ) ,
897901 kind : match & i. kind {
898- AssocItemKind :: Const ( ..) => hir:: AssocItemKind :: Const ,
902+ AssocItemKind :: Static ( ..) // Let's pretend this is a `const` for recovery.
903+ | AssocItemKind :: Const ( ..) => hir:: AssocItemKind :: Const ,
899904 AssocItemKind :: TyAlias ( _, _, ty) => {
900905 match ty. as_deref ( ) . and_then ( |ty| ty. kind . opaque_top_hack ( ) ) {
901906 None => hir:: AssocItemKind :: Type ,
0 commit comments