File tree 3 files changed +28
-1
lines changed
3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -6538,8 +6538,14 @@ impl<'a> Parser<'a> {
6538
6538
let bounds = self . parse_generic_bounds ( ) ?;
6539
6539
tps. where_clause = self . parse_where_clause ( ) ?;
6540
6540
self . expect ( & token:: Semi ) ?;
6541
+ if is_auto == IsAuto :: Yes {
6542
+ let msg = "trait aliases cannot be `auto`" ;
6543
+ self . struct_span_err ( self . prev_span , msg)
6544
+ . span_label ( self . prev_span , msg)
6545
+ . emit ( ) ;
6546
+ }
6541
6547
if unsafety != Unsafety :: Normal {
6542
- let msg = "trait aliases cannot be unsafe" ;
6548
+ let msg = "trait aliases cannot be ` unsafe` " ;
6543
6549
self . struct_span_err ( self . prev_span , msg)
6544
6550
. span_label ( self . prev_span , msg)
6545
6551
. emit ( ) ;
Original file line number Diff line number Diff line change
1
+ #![ feature( trait_alias) ]
2
+
3
+ trait Foo { }
4
+ auto trait A = Foo ; //~ ERROR trait aliases cannot be `auto`
5
+ unsafe trait B = Foo ; //~ ERROR trait aliases cannot be `unsafe`
6
+
7
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error: trait aliases cannot be `auto`
2
+ --> $DIR/trait-alias-syntax.rs:4:19
3
+ |
4
+ LL | auto trait A = Foo; //~ ERROR trait aliases cannot be `auto`
5
+ | ^ trait aliases cannot be `auto`
6
+
7
+ error: trait aliases cannot be `unsafe`
8
+ --> $DIR/trait-alias-syntax.rs:5:21
9
+ |
10
+ LL | unsafe trait B = Foo; //~ ERROR trait aliases cannot be `unsafe`
11
+ | ^ trait aliases cannot be `unsafe`
12
+
13
+ error: aborting due to 2 previous errors
14
+
You can’t perform that action at this time.
0 commit comments