File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 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> {
65386538 let bounds = self . parse_generic_bounds ( ) ?;
65396539 tps. where_clause = self . parse_where_clause ( ) ?;
65406540 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+ }
65416547 if unsafety != Unsafety :: Normal {
6542- let msg = "trait aliases cannot be unsafe" ;
6548+ let msg = "trait aliases cannot be ` unsafe` " ;
65436549 self . struct_span_err ( self . prev_span , msg)
65446550 . span_label ( self . prev_span , msg)
65456551 . 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