File tree Expand file tree Collapse file tree 3 files changed +5
-17
lines changed
compiler/rustc_ast_passes Expand file tree Collapse file tree 3 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -97,9 +97,6 @@ ast_passes_fn_body_extern = incorrect function inside `extern` block
9797ast_passes_fn_param_c_var_args_not_last =
9898 `...` must be the last argument of a C-variadic function
9999
100- ast_passes_fn_param_c_var_args_only =
101- C-variadic function must be declared with at least one named argument
102-
103100ast_passes_fn_param_doc_comment =
104101 documentation comments cannot be applied to function parameters
105102 .label = doc comments are not allowed here
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ impl<'a> AstValidator<'a> {
365365
366366 fn check_fn_decl ( & self , fn_decl : & FnDecl , self_semantic : SelfSemantic ) {
367367 self . check_decl_num_args ( fn_decl) ;
368- self . check_decl_cvaradic_pos ( fn_decl) ;
368+ self . check_decl_cvariadic_pos ( fn_decl) ;
369369 self . check_decl_attrs ( fn_decl) ;
370370 self . check_decl_self_param ( fn_decl, self_semantic) ;
371371 }
@@ -380,13 +380,11 @@ impl<'a> AstValidator<'a> {
380380 }
381381 }
382382
383- fn check_decl_cvaradic_pos ( & self , fn_decl : & FnDecl ) {
383+ /// Emits an error if a function declaration has a variadic parameter in the
384+ /// beginning or middle of parameter list.
385+ /// Example: `fn foo(..., x: i32)` will emit an error.
386+ fn check_decl_cvariadic_pos ( & self , fn_decl : & FnDecl ) {
384387 match & * fn_decl. inputs {
385- [ Param { ty, span, .. } ] => {
386- if let TyKind :: CVarArgs = ty. kind {
387- self . dcx ( ) . emit_err ( errors:: FnParamCVarArgsOnly { span : * span } ) ;
388- }
389- }
390388 [ ps @ .., _] => {
391389 for Param { ty, span, .. } in ps {
392390 if let TyKind :: CVarArgs = ty. kind {
Original file line number Diff line number Diff line change @@ -92,13 +92,6 @@ pub struct FnParamTooMany {
9292 pub max_num_args : usize ,
9393}
9494
95- #[ derive( Diagnostic ) ]
96- #[ diag( ast_passes_fn_param_c_var_args_only) ]
97- pub struct FnParamCVarArgsOnly {
98- #[ primary_span]
99- pub span : Span ,
100- }
101-
10295#[ derive( Diagnostic ) ]
10396#[ diag( ast_passes_fn_param_c_var_args_not_last) ]
10497pub struct FnParamCVarArgsNotLast {
You can’t perform that action at this time.
0 commit comments