@@ -706,14 +706,20 @@ impl CheckAttrVisitor<'_> {
706
706
true
707
707
}
708
708
709
- fn check_doc_tuple_variadic ( & self , meta : & NestedMetaItem , hir_id : HirId ) -> bool {
709
+ fn check_doc_fake_variadic ( & self , meta : & NestedMetaItem , hir_id : HirId ) -> bool {
710
710
match self . tcx . hir ( ) . find ( hir_id) . and_then ( |node| match node {
711
711
hir:: Node :: Item ( item) => Some ( & item. kind ) ,
712
712
_ => None ,
713
713
} ) {
714
714
Some ( ItemKind :: Impl ( ref i) ) => {
715
- if !matches ! ( & i. self_ty. kind, hir:: TyKind :: Tup ( [ _] ) ) {
716
- self . tcx . sess . emit_err ( errors:: DocTupleVariadicNotFirst { span : meta. span ( ) } ) ;
715
+ let is_valid = matches ! ( & i. self_ty. kind, hir:: TyKind :: Tup ( [ _] ) )
716
+ || if let hir:: TyKind :: BareFn ( bare_fn_ty) = & i. self_ty . kind {
717
+ bare_fn_ty. decl . inputs . len ( ) == 1
718
+ } else {
719
+ false
720
+ } ;
721
+ if !is_valid {
722
+ self . tcx . sess . emit_err ( errors:: DocFakeVariadicNotValid { span : meta. span ( ) } ) ;
717
723
return false ;
718
724
}
719
725
}
@@ -887,9 +893,9 @@ impl CheckAttrVisitor<'_> {
887
893
is_valid = false
888
894
}
889
895
890
- sym:: tuple_variadic
891
- if !self . check_attr_not_crate_level ( meta, hir_id, "tuple_variadic " )
892
- || !self . check_doc_tuple_variadic ( meta, hir_id) =>
896
+ sym:: fake_variadic
897
+ if !self . check_attr_not_crate_level ( meta, hir_id, "fake_variadic " )
898
+ || !self . check_doc_fake_variadic ( meta, hir_id) =>
893
899
{
894
900
is_valid = false
895
901
}
@@ -939,7 +945,7 @@ impl CheckAttrVisitor<'_> {
939
945
| sym:: notable_trait
940
946
| sym:: passes
941
947
| sym:: plugins
942
- | sym:: tuple_variadic => { }
948
+ | sym:: fake_variadic => { }
943
949
944
950
sym:: test => {
945
951
if !self . check_test_attr ( meta, hir_id) {
0 commit comments