]> git.lizzy.rs Git - rust.git/commitdiff
extract error_illegal_c_variadic_ty
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 8 Dec 2019 08:01:26 +0000 (09:01 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sat, 21 Dec 2019 18:20:41 +0000 (19:20 +0100)
src/librustc_parse/parser/ty.rs

index ddbb9afa02b3282baae21568a242b8d257814260..840461d75be0190853e7cf7f25135e7d7204baef 100644 (file)
@@ -128,14 +128,7 @@ fn parse_ty_common(
             } else {
                 // FIXME(Centril): Should we just allow `...` syntactically
                 // anywhere in a type and use semantic restrictions instead?
-                struct_span_err!(
-                    self.sess.span_diagnostic,
-                    lo.to(self.prev_span),
-                    E0743,
-                    "C-variadic type `...` may not be nested inside another type",
-                )
-                .emit();
-
+                self.error_illegal_c_varadic_ty(lo);
                 TyKind::Err
             }
         } else {
@@ -335,6 +328,16 @@ fn parse_path_start_ty(&mut self, lo: Span, allow_plus: bool) -> PResult<'a, TyK
         }
     }
 
+    fn error_illegal_c_varadic_ty(&self, lo: Span) {
+        struct_span_err!(
+            self.sess.span_diagnostic,
+            lo.to(self.prev_span),
+            E0743,
+            "C-variadic type `...` may not be nested inside another type",
+        )
+        .emit();
+    }
+
     pub(super) fn parse_generic_bounds(&mut self,
                                   colon_span: Option<Span>) -> PResult<'a, GenericBounds> {
         self.parse_generic_bounds_common(true, colon_span)