diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-08 09:01:26 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-21 19:20:41 +0100 |
| commit | 6f1f6a6c33560ec9864ae367c8e2732cddbb2626 (patch) | |
| tree | a133c38552eae00c61e2675c828340f8aef5a9e7 | |
| parent | 85d3ed9c90cdf6802d3425f08eddb3f4f38d2429 (diff) | |
| download | rust-6f1f6a6c33560ec9864ae367c8e2732cddbb2626.tar.gz rust-6f1f6a6c33560ec9864ae367c8e2732cddbb2626.zip | |
extract error_illegal_c_variadic_ty
| -rw-r--r-- | src/librustc_parse/parser/ty.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs index ddbb9afa02b..840461d75be 100644 --- a/src/librustc_parse/parser/ty.rs +++ b/src/librustc_parse/parser/ty.rs @@ -128,14 +128,7 @@ impl<'a> Parser<'a> { } 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 @@ impl<'a> Parser<'a> { } } + 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) |
