@@ -1084,23 +1084,30 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
1084
1084
_ => visit:: walk_item ( self , item) ,
1085
1085
}
1086
1086
}
1087
- ItemKind :: Const ( box ConstItem { defaultness, expr, .. } ) => {
1087
+ ItemKind :: Const ( box ConstItem { defaultness, expr, distributed_slice , .. } ) => {
1088
1088
self . check_defaultness ( item. span , * defaultness) ;
1089
- if expr. is_none ( ) {
1089
+
1090
+ // declarations of global registries have no body deliberately - items are added
1091
+ // later using global registry additions
1092
+ if expr. is_none ( ) && !matches ! ( distributed_slice, DistributedSlice :: Declaration ( _) )
1093
+ {
1090
1094
self . dcx ( ) . emit_err ( errors:: ConstWithoutBody {
1091
1095
span : item. span ,
1092
1096
replace_span : self . ending_semi_or_hi ( item. span ) ,
1093
1097
} ) ;
1094
1098
}
1095
1099
visit:: walk_item ( self , item) ;
1096
1100
}
1097
- ItemKind :: Static ( box StaticItem { expr, safety, .. } ) => {
1101
+ ItemKind :: Static ( box StaticItem { expr, safety, distributed_slice , .. } ) => {
1098
1102
self . check_item_safety ( item. span , * safety) ;
1099
1103
if matches ! ( safety, Safety :: Unsafe ( _) ) {
1100
1104
self . dcx ( ) . emit_err ( errors:: UnsafeStatic { span : item. span } ) ;
1101
1105
}
1102
1106
1103
- if expr. is_none ( ) {
1107
+ // declarations of global registries have no body deliberately - items are added
1108
+ // later using global registry additions
1109
+ if expr. is_none ( ) && !matches ! ( distributed_slice, DistributedSlice :: Declaration ( _) )
1110
+ {
1104
1111
self . dcx ( ) . emit_err ( errors:: StaticWithoutBody {
1105
1112
span : item. span ,
1106
1113
replace_span : self . ending_semi_or_hi ( item. span ) ,
0 commit comments