extract error_illegal_c_variadic_ty

This commit is contained in:
Mazdak Farrokhzad 2019-12-08 09:01:26 +01:00
parent 85d3ed9c90
commit 6f1f6a6c33

View file

@ -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)