about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-02-13 04:37:07 +0100
committerGitHub <noreply@github.com>2019-02-13 04:37:07 +0100
commita5e869eb6297d2afb3175b17fb0bae5e771ffeef (patch)
tree78b410224b6d98fe44dc3047cbcb05fbafcc2801 /src/libsyntax
parent5aa260a4b56b30e553f82ed31cba384cbf40ae5d (diff)
parent370f1f26ce95defb2cf3cca838e74d9dc43e4829 (diff)
downloadrust-a5e869eb6297d2afb3175b17fb0bae5e771ffeef.tar.gz
rust-a5e869eb6297d2afb3175b17fb0bae5e771ffeef.zip
Rollup merge of #58387 - alexreg:fix-trait-alias-2, r=centril
Disallow `auto` trait alias syntax

See https://github.com/rust-lang/rust/issues/41517#issuecomment-462567679.

r? @Centril

CC @topecongiro @nikomatsakis
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 50cedc0f8d4..e22047938e5 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -6538,8 +6538,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();