@@ -935,6 +935,13 @@ impl<'a> AstValidator<'a> {
935935 match fn_ctxt {
936936 FnCtxt :: Foreign => return ,
937937 FnCtxt :: Free | FnCtxt :: Assoc ( _) => {
938+ // Reject `...` without a pattern post-expansion. The varargs_without_pattern
939+ // FCW is already triggered pre-expansion.
940+ if let PatKind :: Missing = variadic_param. pat . kind {
941+ self . dcx ( )
942+ . emit_err ( diagnostics:: VarargsWithoutPattern { span : variadic_param. span } ) ;
943+ }
944+
938945 match self . sess . target . supports_c_variadic_definitions ( ) {
939946 CVariadicStatus :: NotSupported => {
940947 self . dcx ( ) . emit_err ( diagnostics:: CVariadicNotSupported {
@@ -1259,10 +1266,10 @@ impl<'a> AstValidator<'a> {
12591266 }
12601267
12611268 // Check EII implementation attributes against an allowlist.
1262- fn check_eii_impl_attrs ( & self , attrs : & [ Attribute ] , eii_impls : & [ EiiImpl ] ) {
1263- if eii_impls . is_empty ( ) {
1269+ fn check_eii_impl_attrs ( & self , attrs : & [ Attribute ] , eii_impl : & Option < Box < EiiImpl > > ) {
1270+ let Some ( eii_impl ) = eii_impl else {
12641271 return ;
1265- }
1272+ } ;
12661273
12671274 let allowed_attrs: & [ Symbol ] = & [
12681275 sym:: allow,
@@ -1289,14 +1296,12 @@ impl<'a> AstValidator<'a> {
12891296 }
12901297
12911298 let attr_name = pprust:: path_to_string ( & normal. item . path ) ;
1292- for eii_impl in eii_impls {
1293- self . dcx ( ) . emit_err ( diagnostics:: EiiImplAttributeNotSupported {
1294- attr_span : attr. span ,
1295- attr_name : & attr_name,
1296- eii_span : eii_impl. span ,
1297- eii_name : pprust:: path_to_string ( & eii_impl. eii_macro_path ) ,
1298- } ) ;
1299- }
1299+ self . dcx ( ) . emit_err ( diagnostics:: EiiImplAttributeNotSupported {
1300+ attr_span : attr. span ,
1301+ attr_name : & attr_name,
1302+ eii_span : eii_impl. span ,
1303+ eii_name : pprust:: path_to_string ( & eii_impl. eii_macro_path ) ,
1304+ } ) ;
13001305 }
13011306 }
13021307}
@@ -1479,16 +1484,16 @@ impl Visitor<'_> for AstValidator<'_> {
14791484 contract : _,
14801485 body,
14811486 define_opaque : _,
1482- eii_impls ,
1487+ eii_impl ,
14831488 } ,
14841489 ) => {
14851490 self . visit_attrs_vis_ident ( & item. attrs , & item. vis , ident) ;
14861491 self . check_defaultness ( item. span , * defaultness, AllowDefault :: No , AllowFinal :: No ) ;
14871492
1488- for EiiImpl { eii_macro_path, .. } in eii_impls {
1493+ if let Some ( EiiImpl { eii_macro_path, .. } ) = eii_impl {
14891494 self . visit_path ( eii_macro_path) ;
14901495 }
1491- self . check_eii_impl_attrs ( & item. attrs , eii_impls ) ;
1496+ self . check_eii_impl_attrs ( & item. attrs , eii_impl ) ;
14921497
14931498 let is_intrinsic = item. attrs . iter ( ) . any ( |a| a. has_name ( sym:: rustc_intrinsic) ) ;
14941499 if body. is_none ( ) && !is_intrinsic && !self . is_sdylib_interface {
@@ -1664,9 +1669,9 @@ impl Visitor<'_> for AstValidator<'_> {
16641669
16651670 visit:: walk_item ( self , item) ;
16661671 }
1667- ItemKind :: Static ( StaticItem { expr, safety, eii_impls , .. } ) => {
1672+ ItemKind :: Static ( StaticItem { expr, safety, eii_impl , .. } ) => {
16681673 self . check_item_safety ( item. span , * safety) ;
1669- self . check_eii_impl_attrs ( & item. attrs , eii_impls ) ;
1674+ self . check_eii_impl_attrs ( & item. attrs , eii_impl ) ;
16701675 if matches ! ( safety, Safety :: Unsafe ( _) ) {
16711676 self . dcx ( ) . emit_err ( diagnostics:: UnsafeStatic { span : item. span } ) ;
16721677 }
0 commit comments