From aafbf742c2d93686e1a1b24c7c9ce3f0f9cc8921 Mon Sep 17 00:00:00 2001 From: Alexander Regueiro Date: Tue, 12 Feb 2019 01:50:33 +0000 Subject: [PATCH] Disallow `auto` trait alias syntax. --- src/libsyntax/parse/parser.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 69d6407d506fb..8e22ac7ae0268 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6534,8 +6534,14 @@ impl<'a> Parser<'a> { let bounds = self.parse_generic_bounds()?; tps.where_clause = self.parse_where_clause()?; self.expect(&token::Semi)?; + if is_auto == IsAuto::Yes { + let msg = "trait aliases cannot be `auto`"; + self.struct_span_err(self.prev_span, msg) + .span_label(self.prev_span, msg) + .emit(); + } if unsafety != Unsafety::Normal { - let msg = "trait aliases cannot be unsafe"; + let msg = "trait aliases cannot be `unsafe`"; self.struct_span_err(self.prev_span, msg) .span_label(self.prev_span, msg) .emit();